Same view 'lay out' for 2 QTableViews
-
Hi,
At the moment, I have 2 tables. 1 table (name it fileTableView) containts a couple of columns and rows containing data. The second table (call it selectionTableView) has the selected data of the first table (fileTableView).
Now the two tables are aligned horizontal. First you have the fileTableView and beneath that, you have the selectionTableView. Both table views show the exact same columns. For example a column "File Name". When you now change the geometries of the column File Name, for example the width of the column (by dragging the mouse), the same column File Name in the selectionTableView must also change it's geometries. So that I get exactly two of the same table views but with one table containing the selected data from the first table.
Now, I've tried a couple of things, like for example using a signal that get's emitted when changing the header widths: QHeaderView::sectionResized(), but this signal just doesn't get emitted!
I've connected it with the following code:
@QObject::connect(m_fileTableView->horizontalHeader(),SIGNAL(sectionResized(int,int,int)),m_selectionTableView,SLOT(onSectionResized(int,int,int)));@
The onSectionResized is defined as a public slot with the following code:
@QHeaderView* selectionHeader = m_selectionTableView->horizontalHeader();
if(selectionHeader)
return selectionHeader->resizeSection(index, newSize);
else
return ;@While debugging I've found out that the signal doesn't get emitted for the simple reason that the slot onSectionResized never gets called...
So what happens now is that the data in bot tables get's its updates but the columns width's in both tables aren't 'linked'.
Does anyone has a clue why my signal doesn't work or is there another method?
Greetings,
Robin -
Do you get some statements on the command line /debugger output window for the connect statement? Perhaps, there is a problem.
-
No, just checked. I've got no warnings or special statements from the debugger output.