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. How to prevent scaling of Qt app on different screen resolutions in windows as well as other machines??

How to prevent scaling of Qt app on different screen resolutions in windows as well as other machines??

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 5.1k 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.
  • V Offline
    V Offline
    Vikram_Newbie
    wrote on 23 Jan 2020, 15:15 last edited by
    #1

    Hi All,

    I am a newbie to Qt, I read from Qt docs that Qt app are scalable depending on the screen resolution. But, is there any way i can prevent this? I do not want my app window to scale rather I want it to be of fixed height and fixed width on all screen resolutions. Appreciate your help towards this.

    Thanks
    Vikram

    O J 2 Replies Last reply 23 Jan 2020, 15:24
    0
    • V Vikram_Newbie
      23 Jan 2020, 15:15

      Hi All,

      I am a newbie to Qt, I read from Qt docs that Qt app are scalable depending on the screen resolution. But, is there any way i can prevent this? I do not want my app window to scale rather I want it to be of fixed height and fixed width on all screen resolutions. Appreciate your help towards this.

      Thanks
      Vikram

      O Offline
      O Offline
      ODБOï
      wrote on 23 Jan 2020, 15:24 last edited by ODБOï
      #2

      @Vikram_Newbie hi
      see important aspects when developing for several targets here

      1 Reply Last reply
      1
      • V Offline
        V Offline
        Vikram_Newbie
        wrote on 23 Jan 2020, 15:37 last edited by
        #3

        Hi Lelev,

        Thanks for the reply. But, was going through the same page and read that "For games, you would typically want to create a game board that does not scale, so as not to provide an unfair advantage to players on larger screens." So I wanted to know how we can prevent scaling if i never want my Qt app window size to alter.

        J 1 Reply Last reply 23 Jan 2020, 22:35
        0
        • P Offline
          P Offline
          prex
          wrote on 23 Jan 2020, 15:44 last edited by prex
          #4

          If you want to fix the size of the complete main window, you can just define height and width of it. In addition, if you also define the max and min values, it will not be scaleable.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vikram_Newbie
            wrote on 23 Jan 2020, 15:50 last edited by
            #5

            Hi All,

              I saw few posts like https://www.qtcentre.org/threads/2233-QT4-Any-way-to-disable-window-resizing . But, none of them are working.  If i change the resolution of the screen of the windows machine, the Qt app scales up according to the resolution.
            

            Thanks
            Vikram

            1 Reply Last reply
            0
            • V Vikram_Newbie
              23 Jan 2020, 15:37

              Hi Lelev,

              Thanks for the reply. But, was going through the same page and read that "For games, you would typically want to create a game board that does not scale, so as not to provide an unfair advantage to players on larger screens." So I wanted to know how we can prevent scaling if i never want my Qt app window size to alter.

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 23 Jan 2020, 22:35 last edited by
              #6

              Hi, and welcome!

              @Vikram_Newbie said in How to prevent scaling of Qt app on different screen resolutions in windows as well as other machines??:

              I want it to be of fixed height and fixed width on all screen resolutions.

              Could you please clarify: Do you want your app width to be a fixed number of pixels, or a fixed number of centimeters?

              If i change the resolution of the screen of the windows machine, the Qt app scales up according to the resolution.

              Do you mean that the board looks bigger on the same screen if you apply a lower resolution? If so, that is not what the article means by "scaling".

              If that's not what you meant, please post your code to demonstrate your issue.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              V 1 Reply Last reply 26 Jan 2020, 01:01
              2
              • J JKSH
                23 Jan 2020, 22:35

                Hi, and welcome!

                @Vikram_Newbie said in How to prevent scaling of Qt app on different screen resolutions in windows as well as other machines??:

                I want it to be of fixed height and fixed width on all screen resolutions.

                Could you please clarify: Do you want your app width to be a fixed number of pixels, or a fixed number of centimeters?

                If i change the resolution of the screen of the windows machine, the Qt app scales up according to the resolution.

                Do you mean that the board looks bigger on the same screen if you apply a lower resolution? If so, that is not what the article means by "scaling".

                If that's not what you meant, please post your code to demonstrate your issue.

                V Offline
                V Offline
                Vikram_Newbie
                wrote on 26 Jan 2020, 01:01 last edited by
                #7

                @JKSH ,

                 Hi, that is what exactly I meant. I want my app to be of fixed width and height in terms of pixels. I have kept the size as fixed. If I lower the resolution, the app window enlarges. But, I do not need it to appear bigger. Apprrciate your inputs to achieve this.
                
                Example can be as simple as having a push button in the app. Fix the size of app as well as size of push button to be fixed as follows may be.
                 setFixedSize(600, 300);
                 Then run the app in recommended resolution in my resolution settings to get the expected window sizes. Now, if I close the app window, lower the resolution of my machine in Windows and run the app. I can see that the app window appears big. I want it to be as small as it appeared in previous resolution settings. I am using windows 10.
                
                J 1 Reply Last reply 26 Jan 2020, 06:41
                0
                • V Vikram_Newbie
                  26 Jan 2020, 01:01

                  @JKSH ,

                   Hi, that is what exactly I meant. I want my app to be of fixed width and height in terms of pixels. I have kept the size as fixed. If I lower the resolution, the app window enlarges. But, I do not need it to appear bigger. Apprrciate your inputs to achieve this.
                  
                  Example can be as simple as having a push button in the app. Fix the size of app as well as size of push button to be fixed as follows may be.
                   setFixedSize(600, 300);
                   Then run the app in recommended resolution in my resolution settings to get the expected window sizes. Now, if I close the app window, lower the resolution of my machine in Windows and run the app. I can see that the app window appears big. I want it to be as small as it appeared in previous resolution settings. I am using windows 10.
                  
                  J Offline
                  J Offline
                  JKSH
                  Moderators
                  wrote on 26 Jan 2020, 06:41 last edited by
                  #8

                  @Vikram_Newbie said in How to prevent scaling of Qt app on different screen resolutions in windows as well as other machines??:

                  I want my app to be of fixed width and height in terms of pixels.

                  First, you must realize:

                  • If you call setFixedSize(600, 300), then Qt guarantees that your widget is always 600x300 pixels.
                  • When you change the screen's resolution, the size of each pixel changes.
                    • When you increase the screen's resolution, each pixel becomes smaller on the same screen.
                    • When you decrease the screen's resolution, each pixel becomse larger on the same screen.
                    • Your widget remains unchanged; it is always 600x300 pixels no matter what your screen's resolution is.

                  My next question is: Imagine that your app has 2 different users. User X displays your app on a 24" FHD monitor (1920x1080 pixels). User Y displays your app on a 55" FHD TV (also 1920x1080 pixels).

                  1. What size (in centimeters or inches) should your 600x300 window be on the 24" monitor?
                  2. What size (in centimeters or inches) should your 600x300 window be on the 55" TV?

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  3
                  • V Vikram_Newbie
                    23 Jan 2020, 15:15

                    Hi All,

                    I am a newbie to Qt, I read from Qt docs that Qt app are scalable depending on the screen resolution. But, is there any way i can prevent this? I do not want my app window to scale rather I want it to be of fixed height and fixed width on all screen resolutions. Appreciate your help towards this.

                    Thanks
                    Vikram

                    J Offline
                    J Offline
                    JonB
                    wrote on 26 Jan 2020, 08:51 last edited by JonB
                    #9

                    @Vikram_Newbie said in How to prevent scaling of Qt app on different screen resolutions in windows as well as other machines??:

                    I want it to be of fixed height and fixed width on all screen resolutions

                    As @JKSH has said. Correct me if I'm wrong, but, say, a mobile phone has a fair number of pixels resolution but in a much smaller area than on a monitor (must have much smaller physical pixels size). It's one thing to say "I will limit my app to 800 x 600 pixels on both", or similar, but quite another to say "I want my game running on a monitor to occupy the same 8cm x 6cm as it does on a cell phone", you will kill the monitor user's eyesight :)

                    1 Reply Last reply
                    1

                    7/9

                    26 Jan 2020, 01:01

                    • Login

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