QTableView - Not Getting Selection Changed Signal
-
(There indeed is no selectionChanged signal of a QTableView, sorry)
-Do you really need the QItemSelectionModel? It doesn't sound like you are doing anything that complex. I think you want to connect the selectionChanged model of the VIEW to a slot.--connect(materialsTable,-
-SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),-
-dataModel,-
-SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &)));-I would also name your materialsTable materialsTableView or something like that - as to not confuse if the 'table' is a 'tableModel' or a 'tableView'.
-
Yep, it's in the superclass: http://developer.qt.nokia.com/doc/qt-4.8/qabstractitemview.html#signalSection
I was just complaining about that here :) : http://developer.qt.nokia.com/forums/viewthread/12604/
-
Yikes - please ignore everything I've said so far - I was a bit confused (clearly).
Can you do this - handle the clicked() signal of the view (or the mouseRelease event if you're making bigger selections) and then use the view's selectedIndexes function to get the selection?
-
Gah - it is listed under public functions (http://developer.qt.nokia.com/doc/qt-4.8/qlistview.html#memberSection) even though it is protected (it even says protected right in the declaration in the doc!). Sorry, without subclassing the view this method won't do it for you.
-
What's the first thing you should check in QT when signals/slots don't seem to be working correctly? That your class has the Q_OBJECT macro in it. Added this to the APartsTable class definition, and now I'm hitting the breakpoint.
When does Friday get here?
-
Here is a compilable example:
http://programmingexamples.net/wiki/Qt/ModelView/ItemSelectionModel