QMenu stylesheet
-
@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 -
@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.
-
@SourceCreator because you wrote a stylesheet for a QMenuBar and not a QMenu.
@SGaist
Okey... I have my styles.qss created and I added this.
My QMenu stills same. -
How are you using now ?
-
@SGaist
I'm using a .qss file
All styles of widgets are working but the one that is not, is the QMenu's one
In this picture, QMenuBar's one is working -
What I meant is how are you loading it ?
-
@SGaist
I'm using a .qss file
All styles of widgets are working but the one that is not, is the QMenu's one
In this picture, QMenuBar's one is working@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
-
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?