Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Resizing the Panel Window



  • I'm trying to resize the left panel to fill up the left side of the window. I've tried looking through the forum and other places and so far, nothing has worked.

    5249e03a-b131-42a3-aae4-653f9cb7c035-image.png

    d7643cda-bae7-4cd7-a556-4aa04e495308-image.png


  • Lifetime Qt Champion

    Hi,

    Please post your code as text and not as an image. This makes it hard to read while also not allowing it to be copy-pasted for tests.

    As for your issue, you seem to have a grid layout with three columns and you put widgets in column 0 and 2.

    If you want the widgets in column 0 to go next to the widgets in column 2 then you have to set the span accordingly.



  • Sorry, here is the code in text format.

    setObjectName(title);
    mspInstance = this;
    
    setFeatures( QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
    setFocusPolicy(Qt::StrongFocus);
    
    QPalette backgroundColor(palette());
    backgroundColor.setColor(QPalette::Background, Qt::black);
    
    QWidget *pBaseWidget = new QWidget;
    QGridLayout *pLayout = new QGridLayout;
    
    pBaseWidget->setAutoFillBackground(true);
    pBaseWidget->setPalette(backgroundColor);
    
    pBaseWidget->setLayout(pLayout);
    setWidget(pBaseWidget);
    pBaseWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding));
    
    pLayout->addWidget(mpDateGroup(), 0, 0, 1, 2);
    pLayout->addWidget(mpCheckboxGroup(), 1, 0, 1, 2);
    pLayout->addWidget(mpTransmitterGroup(), 2, 0);
    pLayout->addWidget(mpReceiverGroup(), 2, 1);
    pLayout->addWidget(mpDropDownMenuGroup(), 3, 0, 1, 2);
    
    QLabel *pTitle = new QLabel("Recommended Schedule");
    QFont myTitleFont("times", 24);
    pTitle->setFont(myTitleFont);
    pTitle->setAlignment(Qt::AlignCenter);
    pTitle->setStyleSheet("background:lightBlue");
    pLayout->addWidget(pTitle, 4, 0, 1, 2);
    
    pLayout->addWidget(mpProgressBarGroup(), 5, 0, 1, 2);
    pLayout->addWidget(mpRequirementGroup(), 6, 0, 1, 2);
    

  • Lifetime Qt Champion

    Do not forget to add the coding tags to make it readable.

    This code does not seem to include the whole of your interface.


Log in to reply