QSplitter and QTableWidget
Hi. I have a QSplitter widget separating two QTableWidget instances.
I want each table to stretch to its area's dimension. Meaning I want the tables to occupy all the space available to them.
How do I achieve that?
Code:
splitter->addWidget(table1);
splitter->addWidget(table2);
When I pull the handle of the qsplitter, I want the tables to stay stretched to maximum, just like the emails table does in thunderbird.
Re: QSplitter and QTableWidget
Add a layout to the QSplitter and then add your 2 tablewidgets to it.
like,
Code:
pHNewLayout ->addWidget(tablewidget1);
pHNewLayout ->addWidget(tablewidget2);
splitter->setLayout(pHNewLayout );
Re: QSplitter and QTableWidget
Quote:
Originally Posted by
nikhilqt
Add a layout to the QSplitter and then add your 2 tablewidgets to it.
This still doesn't make my two tables to expand to their maximum available space and stay stretched...
Re: QSplitter and QTableWidget
http://doc.qt.nokia.com/4.6/qtableview.html
Quote:
By default, the cells in a table do not expand to fill the available space.
You can make the cells fill the available space by stretching the last header section. Access the relevant header using horizontalHeader() or verticalHeader() and set the header's stretchLastSection property.
To distribute the available space according to the space requirement of each column or row, call the view's resizeColumnsToContents() or resizeRowsToContents() functions.
Re: QSplitter and QTableWidget
tsp, thanks, that's exactly what I was looking for.
it's not a matter of not reading the documentation, it's just that I've been looking at this from the wrong angle... I thought it's a matter of layouting...
Thanks a million, this solves my problem.