QMenu stylesheet
-
@SourceCreator said in QMenu stylesheet:
I am trying to style a QMenu but the code does not accept it.
Hello and welcome. Does this mean you get some error when you try to compile it, or something else?
-
@JonB
No. The problem is that the Menu does not take my style. The mingw does not pick up any problems for me. But when executing the program the menu does not show a custom style -
@SourceCreator because you wrote a stylesheet for a QMenuBar and not a QMenu.
-
How are you using now ?
-
What I meant is how are you loading it ?
-
@SourceCreator Which platform are you on? [EDIT: I see you said "VSCode" => Windows]
@SGaist Is menu background color something which requires Fusion style?
[Found reference: [Solved ] Background color of QMenu by StyleSheet doen't work this] -
There's also QMenu::item subcontrols: https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenu
-
@SourceCreator
TryqApp->setStyle(QStyleFactory::create("fusion")); //or QApplication::setStyle(QStyleFactory::create("Fusion"));
early in your program. Does that change behaviour?
-
@SourceCreator
I don't know what it looks like for you. From the docs example put in theQMenu::item { /* sets background of menu item. set this to something non-transparent if you want menu color and menu item color to be different */ background-color: transparent; }
Does that make it look like it's supposed to?