Hello,
I have a QTreeWidget which I have set up with the options
treeWidget -> setSelectionMode(QAbstractItemView::SingleSelection);
treeWidget -> setSelectionBehavior(QAbstractItemView::SelectRows);
To copy to clipboard, switch view to plain text mode
...and I initally set the first item in the widget to be the 'selected' one by means of:
treeWidget -> setCurrentItem(*it);
QTreeWidgetItemIterator it(treeWidget); // Points to the first item by default
treeWidget -> setCurrentItem(*it);
To copy to clipboard, switch view to plain text mode
Finally, I have successfully connected the treeWidget "currentItemChanged" signal to a slot, so that I can verify when the selected item changes (if I understand the documentation correctly, the 'selected item' is automatically the same as the 'current item' whenever the QAbstractItemView::SingleSelection mode is set).
Anyway, everything seems to work as expected, except that there doesn't seem to be any visual indication within the QTreeWidget of which row is selected at a given time. I would expect it to be highlighted in some way (for example, with white text on a blue background), but in fact all the entries in the widget are displayed in exactly the same way.
What am I missing, and how can I ensure that the selected item is properly highlighted?
Thank you.
Bookmarks