zoeker
17th March 2008, 05:55
Hi,
I have a QTreeView in which one of the columns is handled by a delegate producing QComboBox editors in its createEditor function. In paint I'm drawing a snapshot of a combobox into the item area. For quite some time now I've been trying to achieve the look and feel of a real combobox being there, to no avail. You get the look easily, overriding the paint virtual function as described above. Getting the feel however means that the combobox popup should open when I click on such an item and that just doesn't happen - at least one click is needed to enter into edit mode, and a second one to open the popup.
The only solution I've found so far is to open persistent editors for each item in that particular column as soon as the model is set to the view, and also when rows are inserted or removed. However I dislike the idea of using persistent editors, even though the tree is quite small.
Do you know of a way to do this without using persistent editors and without breaking anything else?
I have a QTreeView in which one of the columns is handled by a delegate producing QComboBox editors in its createEditor function. In paint I'm drawing a snapshot of a combobox into the item area. For quite some time now I've been trying to achieve the look and feel of a real combobox being there, to no avail. You get the look easily, overriding the paint virtual function as described above. Getting the feel however means that the combobox popup should open when I click on such an item and that just doesn't happen - at least one click is needed to enter into edit mode, and a second one to open the popup.
The only solution I've found so far is to open persistent editors for each item in that particular column as soon as the model is set to the view, and also when rows are inserted or removed. However I dislike the idea of using persistent editors, even though the tree is quite small.
Do you know of a way to do this without using persistent editors and without breaking anything else?