PDA

View Full Version : Changing selected item color in non-current window.



Doug Broadwell
26th August 2007, 04:21
I have a dialog for associating items in a list widget (QListWidget) with files in a Directory Tree (QTreeView) - the user needs to select (highlight) an item in the list widget, an item in the directory tree, then click an "Associate" button. When either widget has the focus the highlighing is distinctive, while the highlighted item in the widget without foucus is much less distinctive - I would like the current item highlighting to be the same in both widgets regardless of which has the focus. I assume that I need to alter the palette so that the non-focused widget displayes the same as the widget with focus - but I do not see any ColorGroup or ColorRole that corresponds to a selected item without focus.

How to implement?

Thanks
Doug

marcel
26th August 2007, 07:09
Implement delegates for your item views and paint them as you want.

Actually, for the list widget you could do without a delegate, since you can set the background of an item with QListWidgetItem::setBackground.