From ad322157891cec53a7b660629d7c244e75df81d5 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 24 Jul 2010 17:15:00 +0200 Subject: Act on doubleClick in FileTreeWidget When doubleclicking a picture in FileTreeWidget the pictureViewer is shown. Doubleclicking a movie file launches the default movie player. Since PictureViewer is now used in FileSystemWidget and ArchiveTreeView a global instance is needed. The appropriate place for this is a singleton. Since we already had a singleton for QAbstractItemModels I renamed it to SmGlobals and added a function to return a PictureViewer object. Renaming it was quite easy thanks to QtCreator's ability to rename variable names. --- filestreewidget.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'filestreewidget.h') diff --git a/filestreewidget.h b/filestreewidget.h index aafbe97..6f87e62 100644 --- a/filestreewidget.h +++ b/filestreewidget.h @@ -17,6 +17,7 @@ class FilesTreeView; class FilesTreeModel; class FilesTreeSortModel; class SeriesTreeModel; +class PictureViewer; class QContextMenuEvent; class QSpinBox; class QPushButton; @@ -36,6 +37,7 @@ class FilesTreeWidget : public QWidget { private slots: void fileSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous); void fileSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void itemDoubleClicked(const QModelIndex &index); signals: void sizeChanged(qint64); @@ -46,6 +48,7 @@ class FilesTreeWidget : public QWidget { FilesTreeModel *mModel; FilesTreeSortModel *mProxy; SeriesTreeModel *mSeriesModel; + PictureViewer *mPictureViewer; QModelIndexList mSelectedFiles; qint64 mSelectedSize; }; -- cgit v1.2.3-70-g09d2