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. Why does the Form Editor's Preview not match the actual result at runtime?
Forum Updated to NodeBB v4.3 + New Features

Why does the Form Editor's Preview not match the actual result at runtime?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 1.8k Views 1 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.
  • AlveinA Offline
    AlveinA Offline
    Alvein
    wrote on last edited by
    #1

    Hello.

    After a long year of Qt training, I have this question I'm afraid to ask because it seems pretty stupid, but here we go...

    I don't know why all my forms always look ridiculously tiny at runtime. It's not only the form. Everything inside (labels, buttons, etc.) seems like being scaled down for some reason.

    So, I always have to oversize everything at design time to get my desired result, but his is an annoying try-n-error task.

    Strangely, the form preview matches the sizes I see in the editor, but at runtime, it's another story.

    I've experienced this both in Qt Creator and Qt Designer.

    Is there a reason for the design/runtime difference in scale? Am I forgetting something?

    Thanks.

    aha_1980A 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Might be a silly question but are you using layouts when you create your custom widgets ?

      Are you using some high DPI settings ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • AlveinA Alvein

        Hello.

        After a long year of Qt training, I have this question I'm afraid to ask because it seems pretty stupid, but here we go...

        I don't know why all my forms always look ridiculously tiny at runtime. It's not only the form. Everything inside (labels, buttons, etc.) seems like being scaled down for some reason.

        So, I always have to oversize everything at design time to get my desired result, but his is an annoying try-n-error task.

        Strangely, the form preview matches the sizes I see in the editor, but at runtime, it's another story.

        I've experienced this both in Qt Creator and Qt Designer.

        Is there a reason for the design/runtime difference in scale? Am I forgetting something?

        Thanks.

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi @Alvein,

        which platform are you on? And which Qt version are you using?

        Are you using an Hi-DPI screen, or what's your resolution?

        Could you upload a demo project so someone could verify or deny your findings?

        Regards

        Qt has to stay free or it will die.

        1 Reply Last reply
        0
        • AlveinA Offline
          AlveinA Offline
          Alvein
          wrote on last edited by
          #4

          Hello.

          @SGaist,

          At least, I'm always using a layout for the central widget.
          I never place objects using absolute pixel positions.

          My display settings:
          scale-and-layout.JPG
          *No custom scaling.

          @aha_1980,

          Using Windows 10. My Qt version is 5.14.2. I've been experiencing the same problem since my very beginning in Qt (around August 2019). I don't remember what was the last version during those days.

          I have a 4K screen, but I guess that if there was a problem with this, some of my customers had said "why is everything so big" at some point. And that never happened. In fact, I've seen some screenshots (captured by them because of distinct reasons) and never noticed anything different.

          I've uploaded a demo here. It's just the UI. I just placed some controls and set their layouts. Everything else (code and properties) come by default.

          Notice how it looks at design/preview:
          mini-demo-preview.JPG

          Now, notice how it looks at runtime (I've placed the app window over the design form for you to compare the huge difference):
          mini-demo-runtime.JPG

          Thanks guys for your replies.

          JonBJ 1 Reply Last reply
          0
          • AlveinA Alvein

            Hello.

            @SGaist,

            At least, I'm always using a layout for the central widget.
            I never place objects using absolute pixel positions.

            My display settings:
            scale-and-layout.JPG
            *No custom scaling.

            @aha_1980,

            Using Windows 10. My Qt version is 5.14.2. I've been experiencing the same problem since my very beginning in Qt (around August 2019). I don't remember what was the last version during those days.

            I have a 4K screen, but I guess that if there was a problem with this, some of my customers had said "why is everything so big" at some point. And that never happened. In fact, I've seen some screenshots (captured by them because of distinct reasons) and never noticed anything different.

            I've uploaded a demo here. It's just the UI. I just placed some controls and set their layouts. Everything else (code and properties) come by default.

            Notice how it looks at design/preview:
            mini-demo-preview.JPG

            Now, notice how it looks at runtime (I've placed the app window over the design form for you to compare the huge difference):
            mini-demo-runtime.JPG

            Thanks guys for your replies.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by JonB
            #5

            @Alvein
            Can you show picture of the widget hierarchy window in Designer (I think it's the Object view?), at least for me? Do you have a layout on whatever top-level QWidget type you are designing?

            AlveinA 1 Reply Last reply
            0
            • JonBJ JonB

              @Alvein
              Can you show picture of the widget hierarchy window in Designer (I think it's the Object view?), at least for me? Do you have a layout on whatever top-level QWidget type you are designing?

              AlveinA Offline
              AlveinA Offline
              Alvein
              wrote on last edited by
              #6

              @JonB, yes but, even a form with a single button will have the problem. I don't think this has to do with the objects hierarchy...

              mini-demo-layout.JPG

              1 Reply Last reply
              1
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Something does look strange, you seem to have several independent layouts there rather than one main containing the others.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                AlveinA 1 Reply Last reply
                0
                • SGaistS SGaist

                  Something does look strange, you seem to have several independent layouts there rather than one main containing the others.

                  AlveinA Offline
                  AlveinA Offline
                  Alvein
                  wrote on last edited by
                  #8

                  @SGaist, the centralwidget's layout contains the others. I've placed a bunch of layouts just to sort the controls, but it has little to do with the problem. I don't follow what you said either.

                  Anyway. Check this simpler sample:

                  Design/preview. Expected size.
                  mini-demo-dialog-preview.JPG

                  Runtime
                  mini-demo-dialog-runtime.JPG

                  One single layout. Same problem.

                  ....

                  Has somebody opened the previously attached sample project?

                  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