Because using style sheets is way more simple:
Because using style sheets is way more simple:
J-P Nurmi
Well, you are right. Writing:
Qt Code:
listView->setStyleSheet("background-image: url(:images/notselected.png)");To copy to clipboard, switch view to plain text mode
is very quick.
How about the selected state for a qlistview item? Reading through properties I have found selection-background-color; how can i apply a texture also to the selected state?
Thanks
Giuseppe CalÃ
Notice that selection-background-color takes a Brush. Furthermore, Brush can be a PaletteRole. So you could combine QPalette and style sheets to achieve that:
Qt Code:
listView->setPalette(palette); listView->setStyleSheet("selection-color: palette(highlight)");To copy to clipboard, switch view to plain text mode
J-P Nurmi
jiveaxe (9th November 2007)
I am worked on jpn's last code and this is the final implementation:
Qt Code:
{ setPalette(palette); }To copy to clipboard, switch view to plain text mode
(no need to use setStyleSheet()).
Now I have customize the scrollbar look. I'd thought to create a QScrollBar widget with listView as parent thinking so to substitute the default one and working on it, but now my listView have two scrollbars...
Soon as I have a solution will post it.
Giuseppe CalÃ
There is no need to create new scroll bars. You can access the existing scrollbars via QAbstractScrollArea::horizontalScrollBar() and QAbstractScrollArea::verticalScrollBar(). Notice that there are quite a few "Customizing QScrollBar" examples: http://doc.trolltech.com/4.3/stylesh...ing-qscrollbar
Also, you can simply use style sheet selectors to apply the stylesheet to a certain scrollbar. For example a QScrollBar which is child of a QListView:
J-P Nurmi
Bookmarks