diff options
-rw-r--r-- | randomtab.cpp | 12 | ||||
-rw-r--r-- | randomtab.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/randomtab.cpp b/randomtab.cpp index 2d83d9e..5242a2a 100644 --- a/randomtab.cpp +++ b/randomtab.cpp @@ -416,6 +416,7 @@ void RandomTab::select(){ } } fData[5]->setText(fullPath); + fData[5]->setData(fullPath, RandomTab::FullPathRole); } fRootItem->appendRow(fData); } @@ -450,11 +451,12 @@ void RandomTab::playSelected(){ } void RandomTab::playDoubleclicked(QModelIndex idx){ - QString fp = idx.sibling(0, FullPath).data().toString(); - logMessage(QString(tr("Doubleclick on %1")).arg(fp)); - QStringList f = QStringList() << fp; - play(f); - + if(idx.isValid()){ + QModelIndex fpidx = idx.siblingAtColumn(FullPath); + QString fp = fpidx.data(RandomTab::FullPathRole).toString(); + logMessage(QString(tr("Doubleclick on %1")).arg(fp)); + play(QStringList() << fp); + } } void RandomTab::play(const QStringList &files){ diff --git a/randomtab.h b/randomtab.h index c479ac3..10d25bd 100644 --- a/randomtab.h +++ b/randomtab.h @@ -28,7 +28,7 @@ class RandomFileView; class RandomTab : public QWidget { Q_OBJECT public: - enum CustomRoles { IdRole = Qt::UserRole + 1, SizeRole = Qt::UserRole + 2, DurationRole = Qt::UserRole + 3, DvdNoRole = Qt::UserRole + 4 }; + enum CustomRoles { IdRole = Qt::UserRole + 1, SizeRole = Qt::UserRole + 2, DurationRole = Qt::UserRole + 3, DvdNoRole = Qt::UserRole + 4, FullPathRole = Qt::UserRole + 5 }; enum Columns { FileName = 0, Size = 1, Duration = 2, Md5 = 3, Location = 4, FullPath = 5 }; enum { ColumnCount = 6 }; explicit RandomTab(QWidget *parent = nullptr); |