Re: Linking of 2 QTableViews
Connect to the QHeaderView::sectionResized() signal of one table and adjust the size of the other table's headers.
Re: Linking of 2 QTableViews
In the first view,you could have :
Code:
connect(ui.filesView->selectionModel(),
SIGNAL(currentRowChanged(const QModelIndex&,
const QModelIndex&)),
this, SLOT(updateFileView()));
The updated view could have a view with data from the selected file from the first view.
Re: Linking of 2 QTableViews
Seems odd to go to all this effort to duplicate the supplied selection highlighting.
Re: Linking of 2 QTableViews
Quote:
Originally Posted by
wysota
Thanks! I've tried your solution but the wierd thing is that the signal sectionResized doenst get emitted... I've tried a couple of things but everytime when i want to use a signal, it just doens't get emitted when I resize my column. Any idea?
The way I try to connect:
Code:
QObject::connect(m_fileTableView
->horizontalHeader
(),
SIGNAL(sectionResized
(int,
int,
int)),m_selectionTableView,
SLOT(onSectionResized
(int,
int,
int)));
The onSecionResized is defined as a public slot, as it should be. In this slot, I do the following:
Code:
QHeaderView* selectionHeader
= m_selectionTableView
->horizontalHeader
();
if(selectionHeader)
return selectionHeader->resizeSection(index, newSize);
else
return ;
But ok, in debug mode, while using breakpoints, the slot doens't get called. So this means the signals just doens't get emitted.
Quote:
Originally Posted by
ChrisW67
Seems odd to go to all this effort to duplicate the supplied selection highlighting.
Well it does look wierd. What I have is at the left om my screen a file tree view. With this view, I go to a certain folder containing hunderds of measurement files written in a .txt file. All these measurement files are read and certain parameters are loaded into my first table view. The second table view let's me see the selected items from the first table view, but only those selected items. Now, these selected items from the first table view, are selected by a function that looks at the parameters and makes an automatic selection, it's actually a filter to all the measurement files.
With only the selected measurement in the second table view, I create a graph.
Re: Linking of 2 QTableViews
Quote:
Originally Posted by
Taxi
Thanks! I've tried your solution but the wierd thing is that the signal sectionResized doenst get emitted... I've tried a couple of things but everytime when i want to use a signal, it just doens't get emitted when I resize my column. Any idea?
I just finished building something close to yours and updating the second view with data from the selection of the first view works.
:)
Re: Linking of 2 QTableViews
Quote:
Originally Posted by
thefatladysingsopera
I just finished building something close to yours and updating the second view with data from the selection of the first view works.
:)
Well, that's the point I think. The data get's updated. But it's just the view, the columns need to be 'linked' together so that when you change the first columns width, that same column should resize in the second view..