How to make the same stylesheet as the menubar of qt-creator?
-
When the mouse pointer hovers on the menus
Tools
andWindow
, we can get that: the menu magin is 0px, and padding is greater than 0px().So I wrote the below qss codes:
QMenuBar::item { margin: 0px 10px; padding: 5px; }
But it didn't work.
If i want to make the same stylesheet as the menubar of qt-creator, how should I do?
-
When the mouse pointer hovers on the menus
Tools
andWindow
, we can get that: the menu magin is 0px, and padding is greater than 0px().So I wrote the below qss codes:
QMenuBar::item { margin: 0px 10px; padding: 5px; }
But it didn't work.
If i want to make the same stylesheet as the menubar of qt-creator, how should I do?
@Limer
you don't need to set the margin and padding of the items, they should be as you want by default. -
@Limer
you don't need to set the margin and padding of the items, they should be as you want by default.I tried it, but the menus were moved to the top automatically, they didn't centered In the vertical direction.
-
I tried it, but the menus were moved to the top automatically, they didn't centered In the vertical direction.
@Limer
the menu bar is okay, it hasn't moved anywhere; it has the height of the widget that you added after it...
you can try setting the height of that widget to something smaller. -
Hi,
IIRC, Qt Creator is using a custom style. You should take a look at it sources.