summaryrefslogtreecommitdiffstats
path: root/examples/gestures/imageviewer/imagewidget.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-27 11:32:39 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-27 12:06:14 (GMT)
commita69f291170b38166acceef7c93f3b2d6d55c90d1 (patch)
treec8843c2a62fc123e86fdf8b3d06f59a6a9f6b701 /examples/gestures/imageviewer/imagewidget.h
parent42b1e49335377175b73a499236a800fca40a1d3e (diff)
downloadQt-a69f291170b38166acceef7c93f3b2d6d55c90d1.zip
Qt-a69f291170b38166acceef7c93f3b2d6d55c90d1.tar.gz
Qt-a69f291170b38166acceef7c93f3b2d6d55c90d1.tar.bz2
Mac: Fix Imageviewer example, and bugfix gestures
Rev-By: denis
Diffstat (limited to 'examples/gestures/imageviewer/imagewidget.h')
-rw-r--r--examples/gestures/imageviewer/imagewidget.h60
1 files changed, 7 insertions, 53 deletions
diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h
index 588e59b..b20d8ad 100644
--- a/examples/gestures/imageviewer/imagewidget.h
+++ b/examples/gestures/imageviewer/imagewidget.h
@@ -44,12 +44,8 @@
#include <QWidget>
#include <QImage>
-#include <QPixmap>
-
#include <QtGui>
-#include "tapandholdgesture.h"
-
class ImageWidget : public QWidget
{
Q_OBJECT
@@ -62,74 +58,32 @@ public:
protected:
void paintEvent(QPaintEvent*);
void resizeEvent(QResizeEvent*);
- void timerEvent(QTimerEvent*);
- void mousePressEvent(QMouseEvent*);
void mouseDoubleClickEvent(QMouseEvent*);
private slots:
- void gestureTriggered();
- void gestureFinished();
- void gestureCancelled();
+ void panTriggered();
+ void pinchTriggered();
+ void swipeTriggered();
private:
void updateImage();
QImage loadImage(const QString &fileName);
void loadImage();
- void setZoomedIn(bool zoomed);
void goNextImage();
void goPrevImage();
void goToImage(int index);
- QPanGesture *panGesture;
- TapAndHoldGesture *tapAndHoldGesture;
-
QString path;
QStringList files;
int position;
QImage prevImage, nextImage;
QImage currentImage;
- QPixmap pixmap;
- QTransform transformation;
-
- bool zoomedIn;
- int horizontalOffset;
- int verticalOffset;
-
- bool zoomed;
- qreal zoom;
- bool rotated;
- qreal angle;
-
- struct TouchFeedback
- {
- bool tapped;
- QPoint position;
- bool sliding;
- QPoint slidingStartPosition;
- QBasicTimer tapTimer;
- int tapState;
- bool doubleTapped;
- int tapAndHoldState;
-
- enum { MaximumNumberOfTouches = 5 };
- QPoint touches[MaximumNumberOfTouches];
- inline TouchFeedback() { reset(); }
- inline void reset()
- {
- tapped = false;
- sliding = false;
- tapTimer.stop();
- tapState = 0;
- doubleTapped = false;
- tapAndHoldState = 0;
- for (int i = 0; i < MaximumNumberOfTouches; ++i) {
- touches[i] = QPoint();
- }
- }
- } touchFeedback;
- QBasicTimer feedbackFadeOutTimer;
+ float horizontalOffset;
+ float verticalOffset;
+ float rotationAngle;
+ float scaleFactor;
};
#endif