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. QSplitter fill parent, but child of splitter not fill splitter.

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.7k Views 1 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.
  • conradjonesC Offline
    conradjonesC Offline
    conradjones
    wrote on last edited by conradjones
    #1

    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();
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What is control ?

      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
      • conradjonesC Offline
        conradjonesC Offline
        conradjones
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          setSizes might be what you are looking for

          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