summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview
diff options
context:
space:
mode:
authorMontel Laurent <laurent.montel@kdab.com>2012-12-02 22:53:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-05 13:27:27 +0100
commitf775f6dd887e1744816d1320fd50092df93f0371 (patch)
tree727adeea004b5d20a3e308389c2327c7a4db5a9d /examples/widgets/graphicsview
parent422b8dd24ec99caed2a22735f53ffbef110a35ad (diff)
Fix compile with -DQT_NO_WHEELEVENT
Change-Id: Icc345e2a361fc233d7debfa88bef2a3a8375fa8f Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'examples/widgets/graphicsview')
-rw-r--r--examples/widgets/graphicsview/chip/view.cpp2
-rw-r--r--examples/widgets/graphicsview/chip/view.h2
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.cpp2
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.h2
4 files changed, 8 insertions, 0 deletions
diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp
index cb83175744..4b7e6c2ed8 100644
--- a/examples/widgets/graphicsview/chip/view.cpp
+++ b/examples/widgets/graphicsview/chip/view.cpp
@@ -50,6 +50,7 @@
#endif
#include <qmath.h>
+#ifndef QT_NO_WHEELEVENT
void GraphicsView::wheelEvent(QWheelEvent *e)
{
if (e->modifiers() & Qt::ControlModifier) {
@@ -62,6 +63,7 @@ void GraphicsView::wheelEvent(QWheelEvent *e)
QGraphicsView::wheelEvent(e);
}
}
+#endif
View::View(const QString &name, QWidget *parent)
: QFrame(parent)
diff --git a/examples/widgets/graphicsview/chip/view.h b/examples/widgets/graphicsview/chip/view.h
index b6cdc41200..90e0951716 100644
--- a/examples/widgets/graphicsview/chip/view.h
+++ b/examples/widgets/graphicsview/chip/view.h
@@ -60,7 +60,9 @@ public:
GraphicsView(View *v) : QGraphicsView(), view(v) { }
protected:
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *);
+#endif
private:
View *view;
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
index 67b6088079..b501a4f3c1 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
@@ -174,12 +174,14 @@ void GraphWidget::timerEvent(QTimerEvent *event)
}
//! [4]
+#ifndef QT_NO_WHEELEVENT
//! [5]
void GraphWidget::wheelEvent(QWheelEvent *event)
{
scaleView(pow((double)2, -event->delta() / 240.0));
}
//! [5]
+#endif
//! [6]
void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.h b/examples/widgets/graphicsview/elasticnodes/graphwidget.h
index 064d3bf00a..202c17c204 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.h
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.h
@@ -63,7 +63,9 @@ public slots:
protected:
void keyPressEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *event);
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event);
+#endif
void drawBackground(QPainter *painter, const QRectF &rect);
void scaleView(qreal scaleFactor);