Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QMenu and QT_SCALE_FACTOR

    General and Desktop
    2
    3
    310
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      Francky033 last edited by

      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.
      1x.png

      With a Parameter QT_SCALE_FACTOR == 1.5, the display is also normal and the size of the menu is multiplied by 1.5.
      15x.png

      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.
      07.png
      (here with QT_SCALE_FACTOR = 0.7)

      How can I correct this?

      Thanx!

      1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        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.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply Reply Quote 0
        • F
          Francky033 last edited by Francky033

          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; }");
          

          Untitled-1.png

          1 Reply Last reply Reply Quote 0
          • First post
            Last post