diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-03-27 09:57:59 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-28 12:59:13 +0100 |
commit | c0701f3789acf3234e9f6431b4e8c7dc3ccefabb (patch) | |
tree | d9dba40b4c270a0cf7939946b2e2f73b4c1c9144 /examples/widgets/gestures/imagegestures/imagewidget.h | |
parent | 4cb0e9650599cb9b94651bb4f9e62bfdafde1ec4 (diff) |
Polish the image gestures example.
- Add a command line parser to properly evaluate help option and
directory argument, add options to disable gestures.
- Add logging category so that the user can actually see what is
happening.
- Scale large images.
- Use qreal instead of float.
- Minor polishing: set window title, position file dialog at
pictures location.
Task-number: QTBUG-37759
Task-number: QTBUG-37203
Change-Id: Ibaf54a13034b150386a8aee476f83a9eba298298
Reviewed-by: Indrajit Tapadar <indrajit.tapadar@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'examples/widgets/gestures/imagegestures/imagewidget.h')
-rw-r--r-- | examples/widgets/gestures/imagegestures/imagewidget.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/examples/widgets/gestures/imagegestures/imagewidget.h b/examples/widgets/gestures/imagegestures/imagewidget.h index 7aaf554117..d061935fe0 100644 --- a/examples/widgets/gestures/imagegestures/imagewidget.h +++ b/examples/widgets/gestures/imagegestures/imagewidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Toolkit. @@ -52,6 +52,8 @@ class QPinchGesture; class QSwipeGesture; QT_END_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcExample) + //! [class definition begin] class ImageWidget : public QWidget { @@ -60,6 +62,7 @@ class ImageWidget : public QWidget public: ImageWidget(QWidget *parent = 0); void openDirectory(const QString &path); + void grabGestures(const QList<Qt::GestureType> &gestures); protected: bool event(QEvent *event); @@ -88,11 +91,11 @@ private: QImage prevImage, nextImage; QImage currentImage; - float horizontalOffset; - float verticalOffset; - float rotationAngle; - float scaleFactor; - float currentStepScaleFactor; + qreal horizontalOffset; + qreal verticalOffset; + qreal rotationAngle; + qreal scaleFactor; + qreal currentStepScaleFactor; //! [class definition end] }; //! [class definition end] |