diff options
author | Sergey Starosek <sergey.starosek@gmail.com> | 2014-06-27 16:16:55 +0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-27 06:56:16 -0700 |
commit | d1511aa9680d17c28ded0ee9b5472b1189edac65 (patch) | |
tree | d5e6d201860967ab6b0239a8b8b09810133f5132 | |
parent | b6fac74f6edfe7a0c129676f62c6c9cb4819cea1 (diff) | |
download | subsurface-d1511aa9680d17c28ded0ee9b5472b1189edac65.tar.gz |
Emit signal on photo double-click
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/divepicturewidget.cpp | 10 | ||||
-rw-r--r-- | qt-ui/divepicturewidget.h | 7 |
2 files changed, 16 insertions, 1 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp index 6849146d5..6742fc274 100644 --- a/qt-ui/divepicturewidget.cpp +++ b/qt-ui/divepicturewidget.cpp @@ -77,6 +77,9 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const break; case Qt::DisplayRole: ret = QFileInfo(key).fileName(); + break; + case Qt::DisplayPropertyRole: + ret = QFileInfo(key).filePath(); } } else if (index.column() == 1) { switch (role) { @@ -94,4 +97,11 @@ int DivePictureModel::rowCount(const QModelIndex &parent) const DivePictureWidget::DivePictureWidget(QWidget *parent) : QListView(parent) { + connect(this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(doubleClicked(const QModelIndex &))); +} + +void DivePictureWidget::doubleClicked(const QModelIndex &index) +{ + QString filePath = model()->data(index, Qt::DisplayPropertyRole).toString(); + emit photoDoubleClicked(filePath); } diff --git a/qt-ui/divepicturewidget.h b/qt-ui/divepicturewidget.h index fde7c5a9a..f0ddebed9 100644 --- a/qt-ui/divepicturewidget.h +++ b/qt-ui/divepicturewidget.h @@ -33,9 +33,14 @@ class DivePictureWidget : public QListView { Q_OBJECT public: DivePictureWidget(QWidget *parent); +signals: + void photoDoubleClicked(const QString filePath); +private +slots: + void doubleClicked(const QModelIndex &index); }; class DivePictureThumbnailThread : public QThread { }; -#endif
\ No newline at end of file +#endif |