Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
None
-
4.7.0
-
None
Description
The item delegate (QItemDelegate) does not receive a valid, current cell rect of an item in the model in the sizeHint(). Without this information it is impossible to calculate the height of the size hint if it depends on the width. An example of this is wrapped text.
This works with QTableView.
Attached is an example that shows this behavior.
In the example, resize the columns of the treeview. Then in main() comment the tree view and uncomment the table view and resize columns.
For the complete discussion, please see [ref:00D26XEw.5002CMl4A:ref ] in support requests.
PS. I have not checked if QListView or QColumnView send a valid option.rect to the itemDelegate().sizeHint(), but those should be fixed too if they don't. height-for-width is a great feature of the layout system in Qt - it should be part of all itemviews as well.