summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-09-09 15:57:09 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-09-09 15:57:49 (GMT)
commite04d43e76049dd2b2bdc15a057292795a946d39b (patch)
tree925a068fd17ace2a3cee353717c492fc4ba7689e /examples
parente58916de4d849a28d291c6d62b27d48a6e9517f0 (diff)
downloadQt-e04d43e76049dd2b2bdc15a057292795a946d39b.zip
Qt-e04d43e76049dd2b2bdc15a057292795a946d39b.tar.gz
Qt-e04d43e76049dd2b2bdc15a057292795a946d39b.tar.bz2
Doc: First part of my review of the gestures overview.
Reviewed-by: Trust Me
Diffstat (limited to 'examples')
-rw-r--r--examples/gestures/imageviewer/imagewidget.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp
index 53a9eb2..e17d746 100644
--- a/examples/gestures/imageviewer/imagewidget.cpp
+++ b/examples/gestures/imageviewer/imagewidget.cpp
@@ -71,8 +71,12 @@ ImageWidget::ImageWidget(QWidget *parent)
connect(pinchGesture, SIGNAL(cancelled()), this, SLOT(pinchTriggered()));
connect(pinchGesture, SIGNAL(triggered()), this, SLOT(pinchTriggered()));
+//! [construct swipe gesture]
QGesture *swipeGesture = new QSwipeGesture(this);
+//! [construct swipe gesture]
+//! [connect swipe gesture]
connect(swipeGesture, SIGNAL(triggered()), this, SLOT(swipeTriggered()));
+//! [connect swipe gesture]
}
void ImageWidget::paintEvent(QPaintEvent*)
@@ -130,12 +134,15 @@ void ImageWidget::pinchTriggered()
update();
}
+//! [swipe slot start]
void ImageWidget::swipeTriggered()
{
QSwipeGesture *pg = qobject_cast<QSwipeGesture*>(sender());
+//! [swipe slot start]
qDebug() << (int) pg->horizontalDirection();
qDebug() << pg->swipeAngle();
+//! [swipe slot finish]
if (pg->horizontalDirection() == QSwipeGesture::Left
|| pg->verticalDirection() == QSwipeGesture::Up)
goPrevImage();
@@ -143,6 +150,7 @@ void ImageWidget::swipeTriggered()
goNextImage();
update();
}
+//! [swipe slot finish]
void ImageWidget::resizeEvent(QResizeEvent*)
{
@@ -245,5 +253,3 @@ void ImageWidget::goToImage(int index)
nextImage = QImage();
update();
}
-
-#include "moc_imagewidget.cpp"