Philipp
6th October 2008, 03:31
Hi,
I am using a QTreeView to display some data. One column is edited using a QComboBox, for which I created a delegate like in the "Spin Box Delegate (http://doc.trolltech.com/4.4/itemviews-spinboxdelegate.html)" example in the documentation. It all works great so far.
Unfortunately, the combo box's height is determined by the default row height of the QTreeView, which is too low.
I am able to add a sizeHint() method to the delegate, which is used by the view. But instead of setting a fixed height I'd like to use the sizeHint() of the combo box. The combo box is created inside createEditor() const method of the delegate, so I can't really use a class variable to store the size hint for later use. And I didn't find a method to get a an editor for a given ModelIndex either.
So am I thinking in the completely wrong direction or is there some other trick to it? I'm sure that's not the first case this has popped up, but I didn't find anything useful on Google.
Philipp
I am using a QTreeView to display some data. One column is edited using a QComboBox, for which I created a delegate like in the "Spin Box Delegate (http://doc.trolltech.com/4.4/itemviews-spinboxdelegate.html)" example in the documentation. It all works great so far.
Unfortunately, the combo box's height is determined by the default row height of the QTreeView, which is too low.
I am able to add a sizeHint() method to the delegate, which is used by the view. But instead of setting a fixed height I'd like to use the sizeHint() of the combo box. The combo box is created inside createEditor() const method of the delegate, so I can't really use a class variable to store the size hint for later use. And I didn't find a method to get a an editor for a given ModelIndex either.
So am I thinking in the completely wrong direction or is there some other trick to it? I'm sure that's not the first case this has popped up, but I didn't find anything useful on Google.
Philipp