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. Screen design problems

Screen design problems

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 3 Posters 2.0k Views 2 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I'm working on an application, I have two screens, my super wide screen (5120 x 1440) and the laptop (1920 x 1080).

    The application main window has a minimum size of 1200x800, on the main display everything fits fine:
    e8b17a69-48fd-43ed-af60-f1b78a34b0c4-image.png

    On the laptop display:
    183086e1-e075-498e-9eba-fc47843bd183-image.png

    It looks like a different font is being used and as a result, very little fits. The language is French.

    Is there anyway I can ensure that a smaller font that will fit is used?

    Kind Regards,
    Sy

    1 Reply Last reply
    0
    • SPlattenS SPlatten

      @artwaw said in Screen design problems:

      https://doc.qt.io/qt-5/highdpi.html

      Looking at that link it shows;

      <application> -platform windows:dpiawareness=0,1,2
      

      How does this translate into an entry in the qt.conf file? I've added:

      [Platforms]
      

      Not sure what the actual configuration should look like.

      [edit] I found something online, not sure if its correct, have edited qt.conf in C:\Qt\Qt5.9.2\5.9.2\msvc2015_64\bin\qt.conf:

      [Platforms]
      WindowsArguments = dip awareness = 0
      
      artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #16

      @SPlatten WindowsArguments = or Windows = I think.

      https://doc.qt.io/qt-5/qt-conf.html

      For more information please re-read.

      Kind Regards,
      Artur

      SPlattenS 1 Reply Last reply
      1
      • AxelViennaA Offline
        AxelViennaA Offline
        AxelVienna
        wrote on last edited by
        #2

        Hi again....
        Regarding your font: Your application seems to fall back to the system's default font. You can set it to a specific font manually, which has to be available (on the respective machine or deployed as a resource within your executable). You can set the font on a widget or application level.

        QFont F("Helvetica"); // get a font from the OS
        F.setStretch(QFont::Unstretched); // in case you do not want it to stretch
        yourWidget->setFont(F); // assign the font to a widget
        QApplication::setFont(F); // assign it for the entire application (in your constructor or even main.cpp);
        

        Regarding the overlap on your laptop:
        Are you using layouts or have you just placed the widgets on the main window?
        It looks like at least the objects under "Localisation reelle" and "Marquages stagiere" are not part of a layout. That is why they don't move or resize when your screen size changes.
        Can you post the code where you build your screen? Or a screenshot of Qt designer if you use it?

        C++ and Python walk into a bar. C++ reuses the first glass.

        SPlattenS 1 Reply Last reply
        0
        • SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #3

          @AxelVienna , thank you, these are two displays connected to the same system, if I start the application on the large display it looks fine, if I start he application on the laptop display it doesn't.

          All the text shown are added to layouts. The addition of widgets to the layouts is all via code, the two you refer to are custom widgets written by myself.

          Kind Regards,
          Sy

          AxelViennaA 1 Reply Last reply
          0
          • AxelViennaA AxelVienna

            Hi again....
            Regarding your font: Your application seems to fall back to the system's default font. You can set it to a specific font manually, which has to be available (on the respective machine or deployed as a resource within your executable). You can set the font on a widget or application level.

            QFont F("Helvetica"); // get a font from the OS
            F.setStretch(QFont::Unstretched); // in case you do not want it to stretch
            yourWidget->setFont(F); // assign the font to a widget
            QApplication::setFont(F); // assign it for the entire application (in your constructor or even main.cpp);
            

            Regarding the overlap on your laptop:
            Are you using layouts or have you just placed the widgets on the main window?
            It looks like at least the objects under "Localisation reelle" and "Marquages stagiere" are not part of a layout. That is why they don't move or resize when your screen size changes.
            Can you post the code where you build your screen? Or a screenshot of Qt designer if you use it?

            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by SPlatten
            #4

            @AxelVienna I would like to report the font's being used, just something like:

            qDebug() << fontInfo.family();
            qDebug() << fontInfo.pixelSize();
            qDebug() << fontInfo.pointSize();
            

            So I can verify what is being used and its size.

            Kind Regards,
            Sy

            AxelViennaA artwawA 2 Replies Last reply
            0
            • SPlattenS SPlatten

              @AxelVienna , thank you, these are two displays connected to the same system, if I start the application on the large display it looks fine, if I start he application on the laptop display it doesn't.

              All the text shown are added to layouts. The addition of widgets to the layouts is all via code, the two you refer to are custom widgets written by myself.

              AxelViennaA Offline
              AxelViennaA Offline
              AxelVienna
              wrote on last edited by
              #5

              @SPlatten Ok, understood. Do your self-written widgets properly handle resize events?

              C++ and Python walk into a bar. C++ reuses the first glass.

              1 Reply Last reply
              0
              • SPlattenS SPlatten

                @AxelVienna I would like to report the font's being used, just something like:

                qDebug() << fontInfo.family();
                qDebug() << fontInfo.pixelSize();
                qDebug() << fontInfo.pointSize();
                

                So I can verify what is being used and its size.

                AxelViennaA Offline
                AxelViennaA Offline
                AxelVienna
                wrote on last edited by
                #6

                @SPlatten said in Screen design problems:

                @AxelVienna I would like to report the font's being used, just something like:

                qDebug() << fontInfo.family();
                qDebug() << fontInfo.pixelSize();
                qDebug() << fontInfo.pointSize();
                

                So I can verify what is being used and its size.

                Good idea...

                C++ and Python walk into a bar. C++ reuses the first glass.

                1 Reply Last reply
                0
                • SPlattenS Offline
                  SPlattenS Offline
                  SPlatten
                  wrote on last edited by
                  #7

                  The font information reported is the same on both displays so I'm very confused:

                  MS Shell Dlg 2
                  16
                  8
                  

                  A pixel is a pixel so why does one fit and the other doesn't?

                  Kind Regards,
                  Sy

                  1 Reply Last reply
                  0
                  • SPlattenS SPlatten

                    @AxelVienna I would like to report the font's being used, just something like:

                    qDebug() << fontInfo.family();
                    qDebug() << fontInfo.pixelSize();
                    qDebug() << fontInfo.pointSize();
                    

                    So I can verify what is being used and its size.

                    artwawA Offline
                    artwawA Offline
                    artwaw
                    wrote on last edited by
                    #8

                    @SPlatten Since you are on Windows - there might be additional issue of desktops scaling per screen I think? At least looks very much alike.

                    https://doc.qt.io/qt-5/highdpi.html

                    For more information please re-read.

                    Kind Regards,
                    Artur

                    SPlattenS 1 Reply Last reply
                    0
                    • AxelViennaA Offline
                      AxelViennaA Offline
                      AxelVienna
                      wrote on last edited by
                      #9

                      Well, if everything is the same on both screens, the issue is screen scaling on desktop level as @artwaw correctly said. You will find it out by trying a totally different executable, e.g. Microsoft Excel and see if it behaves the same.

                      @SPlatten: Regarding your homemade widgets, my suspicion is that they simply do not resize. This can result from multiple reasons, including that no resize methods have been implemented for them.

                      C++ and Python walk into a bar. C++ reuses the first glass.

                      SPlattenS 1 Reply Last reply
                      0
                      • AxelViennaA AxelVienna

                        Well, if everything is the same on both screens, the issue is screen scaling on desktop level as @artwaw correctly said. You will find it out by trying a totally different executable, e.g. Microsoft Excel and see if it behaves the same.

                        @SPlatten: Regarding your homemade widgets, my suspicion is that they simply do not resize. This can result from multiple reasons, including that no resize methods have been implemented for them.

                        SPlattenS Offline
                        SPlattenS Offline
                        SPlatten
                        wrote on last edited by SPlatten
                        #10

                        @AxelVienna The widgets are in the correct position and size on each render, the only issue is the text labels in the QGroupBoxes which appear to small for the labels.

                        Kind Regards,
                        Sy

                        1 Reply Last reply
                        0
                        • AxelViennaA Offline
                          AxelViennaA Offline
                          AxelVienna
                          wrote on last edited by
                          #11

                          @SPlatten: Okay. My suspicion comes from the fact that their headings do not seem to be centered. "Marquage Stagaire" right from the center. Which kind of layout does the QGroupBox "Stagaire" have? And what is the size policy of the QComboBox next to "Stagaire a voir"?

                          C++ and Python walk into a bar. C++ reuses the first glass.

                          1 Reply Last reply
                          0
                          • SPlattenS Offline
                            SPlattenS Offline
                            SPlatten
                            wrote on last edited by
                            #12

                            @AxelVienna , those widgets don't use layouts at all, they are rendered to an offscreen painter then copied as an image to the visible area.

                            Kind Regards,
                            Sy

                            artwawA 1 Reply Last reply
                            0
                            • SPlattenS SPlatten

                              @AxelVienna , those widgets don't use layouts at all, they are rendered to an offscreen painter then copied as an image to the visible area.

                              artwawA Offline
                              artwawA Offline
                              artwaw
                              wrote on last edited by
                              #13

                              @SPlatten I think that's the culprit - layouts provide proper scaling and resize. But I have no idea how can you overcome that using already implemented approach.

                              For more information please re-read.

                              Kind Regards,
                              Artur

                              SPlattenS 1 Reply Last reply
                              0
                              • artwawA artwaw

                                @SPlatten I think that's the culprit - layouts provide proper scaling and resize. But I have no idea how can you overcome that using already implemented approach.

                                SPlattenS Offline
                                SPlattenS Offline
                                SPlatten
                                wrote on last edited by
                                #14

                                @artwaw , don't get distracted those widgets have nothing to do with the group boxes that have labels that don't fit.

                                Kind Regards,
                                Sy

                                1 Reply Last reply
                                0
                                • artwawA artwaw

                                  @SPlatten Since you are on Windows - there might be additional issue of desktops scaling per screen I think? At least looks very much alike.

                                  https://doc.qt.io/qt-5/highdpi.html

                                  SPlattenS Offline
                                  SPlattenS Offline
                                  SPlatten
                                  wrote on last edited by SPlatten
                                  #15

                                  @artwaw said in Screen design problems:

                                  https://doc.qt.io/qt-5/highdpi.html

                                  Looking at that link it shows;

                                  <application> -platform windows:dpiawareness=0,1,2
                                  

                                  How does this translate into an entry in the qt.conf file? I've added:

                                  [Platforms]
                                  

                                  Not sure what the actual configuration should look like.

                                  [edit] I found something online, not sure if its correct, have edited qt.conf in C:\Qt\Qt5.9.2\5.9.2\msvc2015_64\bin\qt.conf:

                                  [Platforms]
                                  WindowsArguments = dip awareness = 0
                                  

                                  Kind Regards,
                                  Sy

                                  artwawA 1 Reply Last reply
                                  0
                                  • SPlattenS SPlatten

                                    @artwaw said in Screen design problems:

                                    https://doc.qt.io/qt-5/highdpi.html

                                    Looking at that link it shows;

                                    <application> -platform windows:dpiawareness=0,1,2
                                    

                                    How does this translate into an entry in the qt.conf file? I've added:

                                    [Platforms]
                                    

                                    Not sure what the actual configuration should look like.

                                    [edit] I found something online, not sure if its correct, have edited qt.conf in C:\Qt\Qt5.9.2\5.9.2\msvc2015_64\bin\qt.conf:

                                    [Platforms]
                                    WindowsArguments = dip awareness = 0
                                    
                                    artwawA Offline
                                    artwawA Offline
                                    artwaw
                                    wrote on last edited by
                                    #16

                                    @SPlatten WindowsArguments = or Windows = I think.

                                    https://doc.qt.io/qt-5/qt-conf.html

                                    For more information please re-read.

                                    Kind Regards,
                                    Artur

                                    SPlattenS 1 Reply Last reply
                                    1
                                    • artwawA artwaw

                                      @SPlatten WindowsArguments = or Windows = I think.

                                      https://doc.qt.io/qt-5/qt-conf.html

                                      SPlattenS Offline
                                      SPlattenS Offline
                                      SPlatten
                                      wrote on last edited by
                                      #17

                                      @artwaw said in Screen design problems:

                                      https://doc.qt.io/qt-5/qt-conf.html

                                      Thank you, I've also used the command line option:

                                      -platform windows:dipawareness=0
                                      

                                      Which works.

                                      Kind Regards,
                                      Sy

                                      1 Reply Last reply
                                      1

                                      • Login

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