PDA

View Full Version : QTreeWidget context menu style



Raadush
3rd July 2012, 08:18
Hi. How to set style for context menu in QTreeWidget. I have application with top menu containing come QActions and want some of theese actions appear when I rightclick inside QTreeWidget.



myTree.setStyleSheet("QWidget {background-color: #fcfcfc}");


Does the trick setting background of context menu, but also sets background for QTreeWidget itself and that I dont want. How to set style for context menu only? Is there some myTree.setStyleSheet("QWidget:contextMenu {background-color: #fcfcfc}");?

high_flyer
3rd July 2012, 11:29
there some myTree.setStyleSheet("QWidget:contextMenu {background-color: #fcfcfc}");?
Why not read the docs?
http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qmenu
http://qt-project.org/doc/qt-4.8/stylesheet-reference.html