- Score * score = scoreList.at(row);
- Course * course = findCourse(score->getClubName(), score->getCourseName());
- viewScore(score, course);
-}
-
-void MainWindow::courseSelectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected)
-{
- QModelIndexList indexes = selected.indexes();
-
- int row = indexes.at(0).row();
-
- QString str = courseListModel->data(indexes.at(0), Qt::DisplayRole).toString();
-
- QStringList strList = str.split(",");
+ const QAbstractItemModel *m = index.model();
+ if (m == scoreListModel) {
+ if (row < scoreList.count()) {
+ Score * score = scoreList.at(row);
+ Course * course = findCourse(score->getClubName(), score->getCourseName());
+ viewScore(score, course);
+ }
+ }
+ else if (m == courseListModel) {
+ QString str = courseListModel->data(index, Qt::DisplayRole).toString();
+ QStringList strList = str.split(",");