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. Too much space between rows in QGroupbox
QtWS25 Last Chance

Too much space between rows in QGroupbox

Scheduled Pinned Locked Moved General and Desktop
qgroupboxsetverticalspac
6 Posts 3 Posters 1.7k 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.
  • J Offline
    J Offline
    Joe Macaroni
    wrote on 19 May 2015, 08:13 last edited by
    #1

    Hey guys,
    I have got a simple QGroupbox with two rows and one column into a QGridboxlayout. As you can see it in the link below, there is too much space between the rows.
    http://i.imgur.com/UCtW9Vl.png
    I don't know how to solve it. I already did couple of settings:
    layout->setVerticalSpacing(1);
    layout->setRowStretch(0,1);
    layout->setRowStretch(1,1);
    layout->setContentsMargins(1,1,1,1);

    I thought if i set VerticalSpacing to 1 its working but there is still to much space. Did I forget something?

    T 1 Reply Last reply 19 May 2015, 11:13
    0
    • J Joe Macaroni
      19 May 2015, 08:13

      Hey guys,
      I have got a simple QGroupbox with two rows and one column into a QGridboxlayout. As you can see it in the link below, there is too much space between the rows.
      http://i.imgur.com/UCtW9Vl.png
      I don't know how to solve it. I already did couple of settings:
      layout->setVerticalSpacing(1);
      layout->setRowStretch(0,1);
      layout->setRowStretch(1,1);
      layout->setContentsMargins(1,1,1,1);

      I thought if i set VerticalSpacing to 1 its working but there is still to much space. Did I forget something?

      T Offline
      T Offline
      tarod.net
      wrote on 19 May 2015, 11:13 last edited by
      #2

      @Joe-Macaroni I don't understand very well. How do you set rows and columns in a QGroupBox?

      "Individually, we are one drop. Together, we are an ocean."

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Joe Macaroni
        wrote on 19 May 2015, 14:35 last edited by
        #3

        Oh sry, I did it like this:

        box = new QGroupBox(this);
        boxLayout = new QGridLayout(this);
        box->setLayout(boxLayout);
        
        boxLayout->addWidget(label1,0,0);
        boxLayout->addWidget(label2,1,0);
        
        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 19 May 2015, 20:26 last edited by SGaist
          #4

          Hi and welcome to devnet,

          Why not use a QVBoxLayout with a stretch at the last position ?

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

          J 1 Reply Last reply 22 May 2015, 10:21
          0
          • S SGaist
            19 May 2015, 20:26

            Hi and welcome to devnet,

            Why not use a QVBoxLayout with a stretch at the last position ?

            J Offline
            J Offline
            Joe Macaroni
            wrote on 22 May 2015, 10:21 last edited by
            #5

            @SGaist

            Because in some case I need more than one column. Sry what do you mean with "with a stretch at the last position" ?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 22 May 2015, 22:19 last edited by
              #6

              I mean't: call the addStretch method form QXXXLayout

              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
              0

              4/6

              19 May 2015, 20:26

              • Login

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