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. Border Layout packing of height in West, Center, and East from South
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 431 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.
  • S Offline
    S Offline
    SRaD
    wrote on last edited by SRaD
    #1

    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;
    }
    
    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