diff options
-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 |