And*_*y M 10
当您有视图时,您将拥有一个用于选择项目的模型.它叫做a QItemSelectionModel.
例如,使用您的QListView,您可以这样获得selectionModel:
QItemSelectionModel* selectionModel() const;
Run Code Online (Sandbox Code Playgroud)
现在,从该模型中,您将能够连接许多信号:
void currentChanged ( const QModelIndex & current, const QModelIndex & previous )
void currentColumnChanged ( const QModelIndex & current, const QModelIndex & previous )
void currentRowChanged ( const QModelIndex & current, const QModelIndex & previous )
void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected )
Run Code Online (Sandbox Code Playgroud)
我想它会对你有所帮助!