QT_SCALE_FACTOR issue for values < 1

  • Hello,

    I am currently developing a desktop application in Qt 5.12.3 ( windows ) and was facing an issue w.r.t resolution.
    When I deploy the application on my customer's premises, I want to either scale up/scale down the application size depending upon the resolution.
    Layouts only help upto a certain extent, as they do not resize the icons within the buttons or change the text font size of components depending upon the resolution of the monitor.

    Setting the environment variable QT_SCALE_FACTOR >= 1 ( say 1.5 , 2 etc ) does the trick for me. It resizes the size of buttons ( and icons within them ), labels ( and their font sizes ) and other gui components.
    However when I have to shrink the application, any value of QT_SCALE_FACTOR < 1 ( say 0.9 or 0.5 ) , it distorts the gui. I am unable to see components such as buttons, labels etc which I have used in my application.

    I'm guessing that I must have missed setting some attributes for QApplication, but I'm unsure.
    Any ideas on what the issue might be ?

  • Lifetime Qt Champion


    Based on this bug report, reduction is not the purpose of that variable.

  • @SGaist Thanks a lot for the prompt response.
    Do you have any suggestions, if I want to reduce the size of the application and its corresponding widget components ( including its icons, font etc ) ?
    Any help or alternatives would be welcome!

  • Lifetime Qt Champion

    If there's a need to cut your UI by half, then you should rather have a GUI that is adapted to such a small screen.

Log in to reply