diff options
author | David Boddie <dboddie@trolltech.com> | 2009-10-16 15:07:48 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-10-16 15:15:24 (GMT) |
commit | 20fd14900702103442ee95dd025706c6f263c6f6 (patch) | |
tree | dccdb3b8110cbe931100b5e31d9432d775ff6c50 /examples/gestures | |
parent | f0688de89cb82f6d3715bb03d7706fca4e6ab86f (diff) | |
download | Qt-20fd14900702103442ee95dd025706c6f263c6f6.zip Qt-20fd14900702103442ee95dd025706c6f263c6f6.tar.gz Qt-20fd14900702103442ee95dd025706c6f263c6f6.tar.bz2 |
Doc: Documentation for gesture features. Still a moving target.
Reviewed-by: Trust Me
Diffstat (limited to 'examples/gestures')
-rw-r--r-- | examples/gestures/imagegestures/imagewidget.cpp | 7 | ||||
-rw-r--r-- | examples/gestures/imagegestures/imagewidget.h | 16 | ||||
-rw-r--r-- | examples/gestures/imagegestures/mainwidget.h | 2 |
3 files changed, 13 insertions, 12 deletions
diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index c4a4e50..95525c5 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -43,6 +43,7 @@ #include <QtGui> +//! [constructor] ImageWidget::ImageWidget(QWidget *parent) : QWidget(parent), position(0), @@ -52,19 +53,15 @@ ImageWidget::ImageWidget(QWidget *parent) scaleFactor(1) { - setObjectName("ImageWidget"); setMinimumSize(QSize(100,100)); - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - //! [enable gestures] grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); grabGesture(Qt::SwipeGesture); //! [enable gestures] } +//! [constructor] //! [event handler] bool ImageWidget::event(QEvent *event) diff --git a/examples/gestures/imagegestures/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h index 7b91fbf..56e2316 100644 --- a/examples/gestures/imagegestures/imagewidget.h +++ b/examples/gestures/imagegestures/imagewidget.h @@ -53,28 +53,28 @@ class QPinchGesture; class QSwipeGesture; QT_END_NAMESPACE +//! [class definition begin] class ImageWidget : public QWidget { Q_OBJECT public: ImageWidget(QWidget *parent = 0); - void openDirectory(const QString &path); protected: - bool event(QEvent*); - bool gestureEvent(QGestureEvent*); - void paintEvent(QPaintEvent*); - void resizeEvent(QResizeEvent*); - void mouseDoubleClickEvent(QMouseEvent*); + bool event(QEvent *event); + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); private: + bool gestureEvent(QGestureEvent *event); void panTriggered(QPanGesture*); void pinchTriggered(QPinchGesture*); void swipeTriggered(QSwipeGesture*); +//! [class definition begin] -private: void updateImage(); QImage loadImage(const QString &fileName); void loadImage(); @@ -93,6 +93,8 @@ private: float verticalOffset; float rotationAngle; float scaleFactor; +//! [class definition end] }; +//! [class definition end] #endif diff --git a/examples/gestures/imagegestures/mainwidget.h b/examples/gestures/imagegestures/mainwidget.h index 1a99155..71b09b0 100644 --- a/examples/gestures/imagegestures/mainwidget.h +++ b/examples/gestures/imagegestures/mainwidget.h @@ -44,6 +44,8 @@ #include <QMainWindow> +class ImageWidget; + class MainWidget : public QMainWindow { Q_OBJECT |