xwhatsit
19th February 2011, 02:21
Hello,
I’m programmatically sorting a QTreeWidget using sortItems(int column, Qt::SortOrder order). It works, of course. However, if I do it right after adding some items to the tree, the sort won’t take effect.
I’ve even tried calling sortItems from a one-shot QTimer. This works a little bit better, but still fails 50% of the time. Clearly something needs to be “updated†or validated in the QTreeWidget before the sort will work.
Is there a way to force the QTreeWidget to update so I can call sortItems immediately?
Many thanks.
I’m programmatically sorting a QTreeWidget using sortItems(int column, Qt::SortOrder order). It works, of course. However, if I do it right after adding some items to the tree, the sort won’t take effect.
I’ve even tried calling sortItems from a one-shot QTimer. This works a little bit better, but still fails 50% of the time. Clearly something needs to be “updated†or validated in the QTreeWidget before the sort will work.
Is there a way to force the QTreeWidget to update so I can call sortItems immediately?
Many thanks.