QSplitter fill parent, but child of splitter not fill splitter.



  • QSplitter fill parent, but child of splitter not fill splitter.

    Hi

    I need to dynamically add items to a QSplitter, i need the QSplitter to fill the parent widget (a wrapper widget which fills the Main Window).

    The QSplitter is vertical, and each row contains a horizontal splitter.

    I need each row to start at a height of say 100 pixels and be resizable, currently my rows fill the whole parent widget.

    Infact I want the rows to stay at the same size unless the user manually resizes them, I also need to show a scrollbar if the total is bigger than the parent window.

    This is what i have so far:
    (do i need the VBoxLayout)

    ArrangeWidget::ArrangeWidget(QWidget *parent) :
        QWidget(parent)
    {
    	this->_mainLayout 	= new QVBoxLayout();
    
    	this->_mainSplitter = new QSplitter(Qt::Vertical);
    	this->_mainSplitter->show();
        
        this->_mainLayout->addWidget(this->_mainSplitter);
        this->setLayout(this->_mainLayout);
    }
    void ArrangeWidget::addRow()
    {
    	QSplitter* row = new QSplitter(Qt::Horizontal, this);
    	Widget1* widget1 = new Widget1();
        widget1->setMinimumSize(QSize(50,100));
        row->addWidget(widget1); 
    	Widget2* widget2 = new Widget2();
    
        row->addWidget(widget2);
    	this->_mainSplitter->addWidget(row);
    	row->show();
    	this->_mainSplitter->show();
    }
    

  • Lifetime Qt Champion

    Hi,

    What is control ?



  • sorry it was widget1. I've edited the post. (I changed the names to simplify the post)


  • Lifetime Qt Champion

    setSizes might be what you are looking for


Log in to reply
 

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