Qlistview Selectionchanged event not found in Qt?

user662285 picture user662285 · Jun 3, 2011 · Viewed 7.8k times · Source

Qlistview Selectionchanged event not found in Qt What is the equivalent of selection changed event in Qlistview in Qt?

Answer

Mat picture Mat · Jun 3, 2011

The selectionChanged signal is generated by the QItemSelectionModel attached to the view, not the view widget itself.

You can get that model by calling selectionModel() on the view object, or by adding your own with setSelectionModel().

This applies both to QListView and QListWidget, since this behavior is handled by the QAbstractItemView which both inherit.

(Class hierarchy is QAbstractItemView < QListView < QListWidget.)

See Handling selections in item view for more information.