Can't change margins of items inside QMenuBar
Solved
General and Desktop
-
Hi,
I have unwanted spacing in between items of my QMenuBar as shown below:
This looks like incorrect margins in between the QMenuBar::item. Therefore, I tried (in my stylesheet) setting the margins to 0 as so:
QMenuBar::item { margin-left: 0px; margin-right: 0px; }
But it doesn't work. I also tried to set it in the code like so:
test->setContentsMargins(0, 0, 0, 0); test1->setContentsMargins(0, 0, 0, 0); test10->setContentsMargins(0, 0, 0, 0); test100->setContentsMargins(0, 0, 0, 0);
where test* is a QMenu pointe. Again, no changes in the GUI.
Finally, I also tried in the stylesheet to set QMenu and QMenu::item to no margins. Again, it doesn't work.
At this point, I'm out of ideas. Any thoughts?
Thank you!
-
@RBLL What about "spacing" or "padding" (not sure), see https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenubar ?