Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMenu and QT_SCALE_FACTOR
QtWS25 Last Chance

QMenu and QT_SCALE_FACTOR

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 498 Views
  • 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 Offline
    F Offline
    Francky033
    wrote on last edited by
    #1

    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
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • F Offline
        F Offline
        Francky033
        wrote on last edited by Francky033
        #3

        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved