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. QLabel scaling issue
Qt 6.11 is out! See what's new in the release blog

QLabel scaling issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 1.1k Views 5 Watching
  • 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.
  • S Offline
    S Offline
    SruDom
    wrote on last edited by
    #1

    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

    raven-worxR 1 Reply Last reply
    0
    • S SruDom

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

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

      QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      S 1 Reply Last reply
      3
      • raven-worxR raven-worx

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

        QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
        
        S Offline
        S Offline
        SruDom
        wrote on last edited by
        #3

        @raven-worx

        I just tried but has no effect

        mrjjM 1 Reply Last reply
        0
        • S SruDom

          @raven-worx

          I just tried but has no effect

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @SruDom

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

          Anyway, did you read this ?
          https://doc.qt.io/qt-5/highdpi.html

          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

          S 1 Reply Last reply
          1
          • mrjjM mrjj

            @SruDom

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

            Anyway, did you read this ?
            https://doc.qt.io/qt-5/highdpi.html

            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

            S Offline
            S Offline
            SruDom
            wrote on last edited by
            #5

            @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?

            JonBJ 1 Reply Last reply
            0
            • S SruDom

              @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?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @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.

              1 Reply Last reply
              4
              • S Offline
                S Offline
                SruDom
                wrote on last edited by
                #7

                '@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..

                Pl45m4P 1 Reply Last reply
                0
                • S SruDom

                  '@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..

                  Pl45m4P Offline
                  Pl45m4P Offline
                  Pl45m4
                  wrote on last edited by
                  #8

                  @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


                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  1 Reply Last reply
                  1
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #9

                    Hi
                    <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 :)

                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      SruDom
                      wrote on last edited by SruDom
                      #10

                      @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.

                      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