QItemSelectionModel signal selectionChanged not called
I have a QSqlQueryModel , I set that model to QItemSelectionModel.
QItemSelectionModel *selectionModel = new QItemSelectionModel(model);
connect(selectionModel,SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),this,SLOT(update1(const QItemSelection &, const QItemSelection &)));
But the selectionChanged doesnot call update1(). May i know why is it not executing?
you also have to "set the selection model to the view":http://qt-project.org/doc/qt-5.0/qtwidgets/qabstractitemview.html#setSelectionModel. The view triggers then the changes in the selection model.
The data model doesn't do anything on the selection model.
Why do you create a new item selection model at all? Item selection is a concern of the view, so an item selection model belongs to the view, and the view will provide a pointer to the selection model it is using.
Use the model as provided by the view, and you're in business.