QMenu and QT_SCALE_FACTOR
-
Hi!
I have a problem with the display of a QMenu and with a parameter QT_SCALE_FACTOR < 1.0
With a parameter QT_SCALE_FACTOR == 1.0, the display is completely normal.
With a Parameter QT_SCALE_FACTOR == 1.5, the display is also normal and the size of the menu is multiplied by 1.5.
On the other hand, when QT_SCALE_FACTOR < 1.0, the display is incorrect, the text is cut off and the highlighting (here in blue) of the menus is incorrect.
(here with QT_SCALE_FACTOR = 0.7)How can I correct this?
Thanx!
-
What Qt version do you use? Can you add a pixmap - I would guess it's not getting scaled so we can't shrink the menu items.
-
I use qt 5.14
I get a better result if I change the menu style by reducing, among other things, the font size. But the behavior of items hovered with the mouse is Strange
myMenu.setStyleSheet("QMenu {background-color: rgb(234,234,234);}" "QMenu::item{ font-family: Arial; font-size: 8pt; color: #111111; padding: 2px 2px 2px 2px; border: 0px solid transparent; background: transparent; }" "QMenu::item:selected {background-color: rgb(0, 255, 255); border: 0px solid transparent; color: #111111;}" "QMenu::separator { height: 2px; margin: 2px 1px 2px 1px; }" "QMenu::indicator {width: 1px; height: 1px; }");