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 properly layout this form
Forum Updated to NodeBB v4.3 + New Features

How to properly layout this form

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 615 Views 3 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.
  • P Offline
    P Offline
    PsylumDan
    wrote on 8 May 2019, 14:41 last edited by
    #1

    In the first image the layout is good. But this the size in Qt Designer. The second image is this window maximized. You can see that the text in the upper portion has gained height. The widget on the bottom left is a label that will hold a pixmap. The two stacked widgets on the right are QChartViews. What I want is, when the window is maximized, the image label and the charts to increase in size and the text at the top to stay the same. I've tried grouping them together in sections and grid layouts. Nothing I do makes it do what I want it to do. Could I get some advice?

    ![alt text](0_1557326169047_1.PNG image url)
    0_1557326180655_2.PNG

    G 1 Reply Last reply 8 May 2019, 14:47
    0
    • P PsylumDan
      8 May 2019, 14:41

      In the first image the layout is good. But this the size in Qt Designer. The second image is this window maximized. You can see that the text in the upper portion has gained height. The widget on the bottom left is a label that will hold a pixmap. The two stacked widgets on the right are QChartViews. What I want is, when the window is maximized, the image label and the charts to increase in size and the text at the top to stay the same. I've tried grouping them together in sections and grid layouts. Nothing I do makes it do what I want it to do. Could I get some advice?

      ![alt text](0_1557326169047_1.PNG image url)
      0_1557326180655_2.PNG

      G Offline
      G Offline
      Gojir4
      wrote on 8 May 2019, 14:47 last edited by Gojir4 5 Aug 2019, 14:48
      #2

      Hi @PsylumDan,

      You need to put stretch factor to 1 for your bottom part, so it will grow instead of your text.

      With QBoxLayout, you can do that using the second argument of QBoxLayout::addWidget or QBoxLayout::addLayout
      With QGridLayout, you can set stretch by row using QGridLayout::setRowStretch

      1 Reply Last reply
      2
      • P Offline
        P Offline
        PsylumDan
        wrote on 8 May 2019, 15:07 last edited by
        #3

        Thanks for the quick reply. I'm doing this in the Qt Designer. Should I be doing it with code instead?

        G M 2 Replies Last reply 8 May 2019, 15:15
        0
        • P PsylumDan
          8 May 2019, 15:07

          Thanks for the quick reply. I'm doing this in the Qt Designer. Should I be doing it with code instead?

          G Offline
          G Offline
          Gojir4
          wrote on 8 May 2019, 15:15 last edited by
          #4

          @PsylumDan Hum Ok,

          No, you can do it by clicking on the root widget containing your layout. Then go at bottom of the properties editor, you can see a section Layout, here you can change the layoutStretch property of each widget.
          Example with 2 widgets, by default you have 0,0, you can put 0,1 to set the last widget having the "growing priority".

          Sorry it could be simple with a picture. But I cannot post them because of proxy.

          1 Reply Last reply
          3
          • P PsylumDan
            8 May 2019, 15:07

            Thanks for the quick reply. I'm doing this in the Qt Designer. Should I be doing it with code instead?

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 8 May 2019, 15:15 last edited by
            #5

            @PsylumDan
            Hi
            You can also do it in Designer.
            alt text

            here told it that to top one should use 2/3 and last should use 1/3
            of the space.

            1 Reply Last reply
            4
            • P Offline
              P Offline
              PsylumDan
              wrote on 8 May 2019, 16:36 last edited by
              #6

              Thanks guys. With ya'lls help I got it working as expected.

              1 Reply Last reply
              0

              1/6

              8 May 2019, 14:41

              • Login

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