Qt World Summit: Register Today!

QLabel scaling issue

  • Hi,

    I've a quick basic question.
    I've designed an app with display screen size 100% (In Windows 7 OS). But now I realize when maginify the screen to 125%, all the labels in my app is also scaled and clipped/cutoff from the screen.

    Is there any QLabel property will prevent this happening? Or is there any other easy work around to this issue?

    Thanks in advance

  • Moderators

    have you tried adding the following line at the beginning of your main (before creating the QApplication instance):


  • @raven-worx

    I just tried but has no effect

  • Lifetime Qt Champion


    did you also try
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, false);
    or the AA_DisableHighDpiScaling

    Anyway, did you read this ?

    Im not sure to what extend Win 7 works as its EOL.

    you can try fiddling with QT_SCALE_FACTOR

    or try running app with
    <application> -platform windows:dpiawareness=0

  • @mrjj Thanks for your suggestions.

    @mrjj said in QLabel scaling issue:

    or try running app with
    <application> -platform windows:dpiawareness=0

    What you mean by that?

  • @SruDom
    @mrjj means: when you run your application pass -platform windows:dpiawareness=0 on the command-line to your executable. You can do that externally (e.g. from a terminal or shortcut desktop icon), or Qt Creator lets you specify runtime command-line arguments.

  • '@JonB Thank you. I tried specify those commands on the run command line argument area on the Qt creator. But I get the following error:

    ...build-POML060_v1-Desktop_Qt_5_12_0_MSVC2015_64bit-Release\release\POML060_v1.exe <application> -platform windows:dpiawareness=0...
    The system cannot find the file specified.

    Not sure what I'm doing wrong here..

  • @SruDom said in QLabel scaling issue:

    build-POML060_v1-Desktop_Qt_5_12_0_MSVC2015_64bit-Release\release\POML060_v1.exe <application> -platform windows:dpiawareness=0

    Overthink what you did there :)
    And read again what @mrjj wrote

  • Lifetime Qt Champion

    <application> should not be included in the cmd line in Creator

    It simply means Your app. The app.
    Sorry I though it sort of a universally way to show it :)

  • @mrjj Thanks :)
    I tried running app with
    -platform windows: dpiawareness = 0
    and tried setting the follwoing in the main.cpp
    QApplication :: setAttribute ( Qt::AA_DisableHighDpiScaling);
    None of them seemed working.

    If I change enlarge the screen from 100% to 125% , some labels and widgets parts are being cutoff. I also tried running the app on Win10 but the issue is same.

Log in to reply