c++ - How to style a submenu item in Qt? -


i style menu item has submenu differently, make submenu standout. style being applied menu items in submenu rather styling submenu item alone.

menu1 menu2 -> menu21           menu22           menu23 menu3 

i wanted style menu2, qt styling menu21, menu22 , menu23.

tried these:

submenu->setstylesheet("qmenu{ font: bold }"); submenu->setstylesheet("qmenu::item{ font: bold }"); submenu->setstylesheet("qmenu::item#submenu{ font : bold }"); 

dynamic properties did not help, setting style on action associated submenu crashing qt! :(

thanks time,

gowtham

see documentation:

i haven't tested this, in theory, may able use qmenu::item either property selector or id selector (see qt style sheet syntax - selectors). example:

qmenu::item[text="menu2 text"] 

or

qmenu::item#menu2id 

though may difficult or set id.

of course, may turn out it's impossible set individual styles qmenu entries outside of cases shown in qt examples.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -