Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Adding data to Frozen Column QTreeWidget
I have created a frozen column
QTreeWidget(first column is not scrollable), by sharing model with a
Any child row is to be added only when parent is expanded. This works fine for the frozen
QTreeView, but any data in other columns do not get displayed in the underlying
QTreeWidget, so all other columns are blank for child rows. (Verified that the child
QTreeWidgetItemdoes contain the data for other columns)
The data added does not get displayed in-order in the widget i.e. even though I insert with
QTreeWidget::addTopLevelItemin a loop, the actual output does not match the order in which the items are added.
What is the correct way of writing this? Also, I tried using
QAbstractItemModelbut that further complicates the model and could not get it working. Is writing a dedicated model the only way?
Never mind, I solved both of the problems.
- Issue was with hooking up event handlers and from where child items were being populated.
- Default sorting was enabled, which was leading to this.
So you made something like
With tree views ?
Good work :)
Yes inspired from that example, though some modification specific to
QTreeView, but everything now works except for few hiccups regarding child row visibility. Posted a separate question.