Reputation: 21
Looked everywhere, and could not find a solution I could apply.
Simple case scenario. I have a submenu with 2 entries.
menu = QMenu("MainMenu", self )
submenu = QMenu("Submenu", menu )
menu.addMenu( submenu )
submenu.addAction( QIcon(""), "entry 1", myFuncs.func1 )
submenu.addAction( QIcon(""), "entry 2", myFuncs.func2 )
For the time being, I just added a line which at least changes all the items' background colors:
submenu.setStyleSheet("QWidget { background-color: %s }" % col_brightGray.name())
But. I would like to change the background color for each of the entries to different shades. Im sure there is a way, but after trying quite a few, I couldnt nail it.
thank you in advance
Upvotes: 2
Views: 3834
Reputation: 5885
QAction not supporting setStylesheet because its not QWidget, Check this http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenu
Upvotes: 1