View Full Version : About the background color of QTreeView itmes
yandy
25th March 2009, 04:57
Is there anyone knows how to set the background color of different itmes in QTreeView?Thanks very much
spirit
25th March 2009, 06:21
in general you can use Qt::BackgroundRole, but if you use QStandardItemMode & QStandardItem then you can use this method QStandardItem::setBackground or you also can create your own delegate and reimplement QItemDelegate::drawBackground.
talk2amulya
26th March 2009, 11:02
another way would be to use stylesheet. The following should work:
QTreeView::item
{
background-color: #your color
}
aamer4yu
26th March 2009, 15:38
If you want to use background color to differentiate items, you can also have a look at QAbstractItemView::setAlternatingRowColors
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.