diff options
-rw-r--r-- | randomtab.cpp | 9 | ||||
-rw-r--r-- | randomtab.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/randomtab.cpp b/randomtab.cpp index 7b0dd59..291dcd7 100644 --- a/randomtab.cpp +++ b/randomtab.cpp @@ -132,6 +132,7 @@ void RandomTab::setupGui(){ mFileView->setRootIsDecorated(false); mFileView->setSelectionMode(QAbstractItemView::ExtendedSelection); mFileView->setSelectionBehavior(QAbstractItemView::SelectRows); + connect(mFileView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(playDoubleclicked(QModelIndex))); mFileModel = new QStandardItemModel; mFileProxy = new QSortFilterProxyModel; mFileProxy->setSourceModel(mFileModel); @@ -452,6 +453,14 @@ void RandomTab::playSelected(){ play(files); } +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); + +} + void RandomTab::play(const QStringList &files){ QPair<QString, QStringList> pgdata = Helper::programData("movieviewer"); QString program = pgdata.first; diff --git a/randomtab.h b/randomtab.h index 15ef087..445210d 100644 --- a/randomtab.h +++ b/randomtab.h @@ -43,6 +43,7 @@ class RandomTab : public QWidget { void select(); void playAll(); void playSelected(); + void playDoubleclicked(QModelIndex idx); void play(const QStringList &files); void logMessage(const QString &msg); |