PDA

View Full Version : QTableWidget resizing when is part of QSplitter



godi
3rd October 2011, 13:05
Hello,

I have a QTableWidget inside a QSplitter and I need the table sections to equally resize when the handle of the QSplitter is moved. This behavior can be achieved by setting a QLinearLayout to the splitter area where the table is and setting the resize mode QHeaderView::Stretch to the table header.

However, in this configuration the user cannot resize manually the width of the columns that is the other need I have.

Is there any way the user can resize manually the width of the columns while these columns are automatically resized when the handle of the splitter is moved?

Thanks is advance.

godi
10th October 2011, 15:47
Nobody can help me? I haven't found any solution to this yet.

Thanks in advance.

wysota
10th October 2011, 17:59
If you have a concept of dealing with a situation that the user resizes some of the columns and then moves the splitter then you can implement your solution by overriding resizeEvent() for the table widget and writing code for adjusting column sizes.

godi
18th October 2011, 15:05
Hello wysota,

I have been outside for several days and I had not read this.

I have implemented the solution you suggested me and it works fine when the splitter is moved because I can control how the new available space is shared among the columns.

However, there is no resize event when a column is resized, then it is not possible to resize the rest of the columns when one of them expands or shrinks.

Is there any solution to know when a column has been resized?

Thanks in advance.

wysota
18th October 2011, 17:05
QHeaderView emits a signal.