From ea30d012b7777a2aea1c5e957a7d7566eebef391 Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 8 Mar 2012 07:09:09 +0100 Subject: Show picture on doubleClick in PicturesWidget Show picture in PictureViewer2 when double clicking an item in pictures widget. Also shuffle some code around. --- pictureviewer2.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'pictureviewer2.h') diff --git a/pictureviewer2.h b/pictureviewer2.h index 7b106bf..6c9035a 100644 --- a/pictureviewer2.h +++ b/pictureviewer2.h @@ -13,16 +13,25 @@ class QGraphicsScene; class QGraphicsPixmapItem; +class QWheelEvent; class PictureViewer2 : public QGraphicsView { Q_OBJECT public: - explicit PictureViewer2(QWidget *parent = 0); //, Qt::WindowFlags f = 0); - void setFiles(const QStringList &files) { mFiles = files; } + explicit PictureViewer2(QWidget *parent = 0); + void addFiles(const QStringList &files, bool clear = true); + void setFile(const QString &file); virtual QSize sizeHint() const; + public slots: + void next(); + void previous(); + + protected: + void wheelEvent(QWheelEvent *event); + private slots: - void setFile(const QString file = mDefaultFile); + void showFile(const QString file); private: void setupDialog(); @@ -32,7 +41,8 @@ class PictureViewer2 : public QGraphicsView { QGraphicsScene *mScene; QSize mMinimunSize; QGraphicsPixmapItem *mCur; - static const QString mDefaultFile; + int mCurPos; + const QString mDefaultFile; }; #endif // PICTUREVIEWER2_H -- cgit v1.2.3-70-g09d2