Border Layout packing of height in West, Center, and East from South



  • I am using the Border Layout example like in the QT example documents within this link ...

    http://doc.qt.io/qt-5/qtwidgets-layouts-borderlayout-example.html
    

    My problem is that when I open my application, there is still room to grab the divider that separates the South layout from the West, Center, and East, and to push it up to make the West, Center, and East layouts a bit thinner (height-wise) and thereby making the South layout taller (higher).

    I'd like to pack the height of the West, Center, and East layouts as tight as they'll go in height.

    Thoughts?

    {
        qslLayout = new QSLLayout;
        qslLayout->setContentsMargins(0, 0, 0, 0); 
        qslLayout->addWidget(createGroupA(), QSLLayout::Center);
        qslLayout->addWidget(createGroupB(), QSLLayout::West);
        qslLayout->addWidget(createGroupC(), QSLLayout::East);
        qslLayout->addWidget(createGroupD(), QSLLayout::East);
        qslLayout->addWidget(createGroupE(), QSLLayout::South);
        
        setLayout(qslLayout);
    }
    
    QGroupBox* Test::createGroupA()
    {
        ag = new QGroupBox(tr("Group A"));
        ag->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    
        labelA1 = new QLabel(tr("labelA1"));
        labelA1->setMinimumWidth(60);
        editA1 = new QLineEdit;
        editA1->setPlaceholderText("edit A");
        editA1->setFocus();
        editA1->setMinimumWidth(60);
    
        labelA2 = new QLabel(tr("labelA2"));
        labelA2->setMinimumWidth(70);
        editA2 = new QDateEdit;
        editA2->setMinimumWidth(100);
    
        labelA3 = new QLabel(tr("labelA3"));
        labelA3->setMinimumWidth(60);
        editA3 = new QTimeEdit;
        editA3->setMinimumWidth(100);
    
        centerLayout = new QHBoxLayout;
        centerLayout->setContentsMargins(0, 0, 0, 0);
        centerLayout->addWidget(labelA1);
        centerLayout->addWidget(editA1);
        centerLayout->addWidget(labelA2);
        centerLayout->addWidget(editA2);
        centerLayout->addWidget(labelA3);
        centerLayout->addWidget(editA3);
        centerLayout->insertStretch(-1, 1);
    
        ag->setLayout(centerLayout);
    
        return ag;
    }
    
    // with the exception of createGroupA (center), groupB (west), groupC (east1)
    // and groupD (east2) look very similar to this one.
    QWidget* Test::createGroupC()
    {
        QHBoxLayout* eastLayout = new QHBoxLayout;
        eastLayout->setContentsMargins(0, 0, 0, 0);
        eastLayout->addWidget(createWidgetC1());
        eastLayout->addWidget(createWidgetC2());
    
        eastView = new QWidget;
        eastView->setLayout(eastLayout);
    
        return eastView;
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.