PDA

View Full Version : Highlighting QTreeWidgetItem



rajesh210
23rd July 2008, 11:12
When I was trying to highlight selected QTreeWidgetItem the display is not proper as expected. I expected the behaviour should highlight only the text portion of the QTreeWidgetItem, but iam getting the highlight till the end of the widget area and is not proper. I have used the below code in the constructorof my class.



QPalette palette = QPalette();
palette.setColor(QPalette::HighlightedText, Qt::white);
palette.setColor(QPalette::Highlight, Qt::blue);
setPalette(palette);

Thanks in advance.

aamer4yu
23rd July 2008, 11:51
I guess what u want is not acheivable directly.
You can achieve it using item delegates. In the delegate u can set the textcharformat for the string....