C++ (Qt)QObject::connect(ProjectView->selectionModel(), SIGNAL(currentRowChanged (const QModelIndex &, const QModelIndex &)), ProjectModel, SLOT(onCurrentChanged (const QModelIndex &, const QModelIndex &))); void TProjectModel::onCurrentChanged (const QModelIndex & current, const QModelIndex & previous) { if(!Project) {return;} if(!current.isValid()) {itemIndex(-1);} itemIndex(current.row());}