PDA

View Full Version : QTableView - Enable Clicking for some columns only



Gabriel
22nd June 2006, 18:50
I'm using Qt 4.1.3 in WinXP and I made a table using QTableModel & QTableView.
I've implemented the model "sort" virtual function and it works fine.
I show the sort indicator on the horizontal header.
Now my question:

I want to enable clicking & sorting just in some columns and disable this behavior it in others.

How can I do that ?
(Show a sort indicator in a non sorting column is horrible )

Gabriel.

jacek
23rd June 2006, 23:42
When user clicks a header section, QHeaderView::sectionClicked() signal is emitted and to sort the table you have to invoke the QTableView::sortByColumn() slot. I guess you have to put something between them and just check whether that slot should be invoked or not.