View Full Version : Changing selected QTreeView item font
dima1000
8th October 2009, 07:38
How can I change the font of selected QTreeView item to bold? Is it possible with stylesheet?
yogeshgokul
8th October 2009, 07:52
This style sheet should work :
QTreeView::item:selected {
bfont: bold;
}
spirit
8th October 2009, 07:52
you can get current item using QAbstractItemView::currentIndex and then using Qt::FontRole set a font.
dima1000
8th October 2009, 08:34
yogeshgokul , it's not working. It's possible to change a colors this way, but not a font :(
spirit, thank you, it's working :)
yogeshgokul
8th October 2009, 09:07
yogeshgokul , it's not working. It's possible to change a colors this way, but not a font :(
There is a typo in style sheet I pasted. Notice that extra "b" before "font". Anyways no probs when your problem is solved. :)
dima1000
8th October 2009, 09:28
I did it with "font", and no with "bfont" :)
Anyway I preffer to do this with stylesheet, because if not, I need to catch selection changes, and to save previous selections to change them back. But I can't find the way to do this with stylesheet.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.