From 7c6deee2325d83f711fd28767467865da7cda848 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 11 Nov 2016 10:44:09 +0100 Subject: Play movie on doublelClick in RandomTab --- randomtab.cpp | 9 +++++++++ randomtab.h | 1 + 2 files changed, 10 insertions(+) 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 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); -- cgit v1.2.3-70-g09d2