Fix compile with -DQT_NO_WHEELEVENT
authorMontel Laurent <laurent.montel@kdab.com>
Sun, 2 Dec 2012 21:53:25 +0000 (22:53 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 5 Dec 2012 12:27:27 +0000 (13:27 +0100)
Change-Id: Icc345e2a361fc233d7debfa88bef2a3a8375fa8f
Reviewed-by: David Faure <david.faure@kdab.com>
examples/threads/mandelbrot/mandelbrotwidget.cpp
examples/threads/mandelbrot/mandelbrotwidget.h
examples/widgets/graphicsview/chip/view.cpp
examples/widgets/graphicsview/chip/view.h
examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
examples/widgets/graphicsview/elasticnodes/graphwidget.h
examples/widgets/painting/affine/xform.cpp
examples/widgets/painting/affine/xform.h
examples/widgets/widgets/mousebuttons/buttontester.cpp
examples/widgets/widgets/mousebuttons/buttontester.h

index c1ec029..3a10a7a 100644 (file)
@@ -162,6 +162,7 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event)
 }
 //! [11]
 
+#ifndef QT_NO_WHEELEVENT
 //! [12]
 void MandelbrotWidget::wheelEvent(QWheelEvent *event)
 {
@@ -170,6 +171,7 @@ void MandelbrotWidget::wheelEvent(QWheelEvent *event)
     zoom(pow(ZoomInFactor, numSteps));
 }
 //! [12]
+#endif
 
 //! [13]
 void MandelbrotWidget::mousePressEvent(QMouseEvent *event)
index ea5fdc5..238a2bd 100644 (file)
@@ -58,7 +58,9 @@ protected:
     void paintEvent(QPaintEvent *event);
     void resizeEvent(QResizeEvent *event);
     void keyPressEvent(QKeyEvent *event);
+#ifndef QT_NO_WHEELEVENT
     void wheelEvent(QWheelEvent *event);
+#endif
     void mousePressEvent(QMouseEvent *event);
     void mouseMoveEvent(QMouseEvent *event);
     void mouseReleaseEvent(QMouseEvent *event);
index cb83175..4b7e6c2 100644 (file)
@@ -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)
index b6cdc41..90e0951 100644 (file)
@@ -60,7 +60,9 @@ public:
     GraphicsView(View *v) : QGraphicsView(), view(v) { }
 
 protected:
+#ifndef QT_NO_WHEELEVENT
     void wheelEvent(QWheelEvent *);
+#endif
 
 private:
     View *view;
index 67b6088..b501a4f 100644 (file)
@@ -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)
index 064d3bf..202c17c 100644 (file)
@@ -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);
index a873ba7..d4485df 100644 (file)
@@ -251,12 +251,14 @@ void XFormView::timerEvent(QTimerEvent *e)
     }
 }
 
+#ifndef QT_NO_WHEELEVENT
 void XFormView::wheelEvent(QWheelEvent *e)
 {
     m_scale += e->delta() / qreal(600);
     m_scale = qMax(qreal(0.1), qMin(qreal(4), m_scale));
     emit scaleChanged(int(m_scale*1000));
 }
+#endif
 
 void XFormView::reset()
 {
index fff9273..a043811 100644 (file)
@@ -116,7 +116,9 @@ signals:
 
 protected:
     void timerEvent(QTimerEvent *e);
+#ifndef QT_NO_WHEELEVENT
     void wheelEvent(QWheelEvent *);
+#endif
 
 private:
     QPolygonF ctrlPoints;
index 6491037..9a631b9 100644 (file)
@@ -68,6 +68,7 @@ void ButtonTester::mouseDoubleClickEvent(QMouseEvent *e)
     this->setText(result);
 }
 
+#ifndef QT_NO_WHEELEVENT
 void ButtonTester::wheelEvent (QWheelEvent *e)
 {
     QString result;
@@ -88,6 +89,7 @@ void ButtonTester::wheelEvent (QWheelEvent *e)
     qDebug() << result;
     this->setText(result);
 }
+#endif
 
 int ButtonTester::buttonByNumber(const Qt::MouseButton button)
 {
index bb1a7b0..2f8db56 100644 (file)
@@ -56,7 +56,9 @@ protected:
     void    mousePressEvent(QMouseEvent *event);
     void    mouseReleaseEvent(QMouseEvent *event);
     void    mouseDoubleClickEvent(QMouseEvent *event);
+#ifndef QT_NO_WHEELEVENT
     void    wheelEvent(QWheelEvent * event);
+#endif
     int     buttonByNumber(const Qt::MouseButton button);
     QString enumNameFromValue(const Qt::MouseButton button);
 };