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

Too much space between rows in QGroupbox

Scheduled Pinned Locked Moved General and Desktop
qgroupboxsetverticalspac
6 Posts 3 Posters 1.8k 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.
  • J Offline
    J Offline
    Joe Macaroni
    wrote on 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
    0
    • J Joe Macaroni

      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 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 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
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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
          0
          • SGaistS SGaist

            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 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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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

              • Login

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