From f775f6dd887e1744816d1320fd50092df93f0371 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Sun, 2 Dec 2012 22:53:25 +0100 Subject: Fix compile with -DQT_NO_WHEELEVENT Change-Id: Icc345e2a361fc233d7debfa88bef2a3a8375fa8f Reviewed-by: David Faure --- examples/threads/mandelbrot/mandelbrotwidget.cpp | 2 ++ examples/threads/mandelbrot/mandelbrotwidget.h | 2 ++ examples/widgets/graphicsview/chip/view.cpp | 2 ++ examples/widgets/graphicsview/chip/view.h | 2 ++ examples/widgets/graphicsview/elasticnodes/graphwidget.cpp | 2 ++ examples/widgets/graphicsview/elasticnodes/graphwidget.h | 2 ++ examples/widgets/painting/affine/xform.cpp | 2 ++ examples/widgets/painting/affine/xform.h | 2 ++ examples/widgets/widgets/mousebuttons/buttontester.cpp | 2 ++ examples/widgets/widgets/mousebuttons/buttontester.h | 2 ++ 10 files changed, 20 insertions(+) diff --git a/examples/threads/mandelbrot/mandelbrotwidget.cpp b/examples/threads/mandelbrot/mandelbrotwidget.cpp index c1ec029548..3a10a7a726 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/threads/mandelbrot/mandelbrotwidget.cpp @@ -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) diff --git a/examples/threads/mandelbrot/mandelbrotwidget.h b/examples/threads/mandelbrot/mandelbrotwidget.h index ea5fdc53c1..238a2bdca1 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/threads/mandelbrot/mandelbrotwidget.h @@ -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); 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 +#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); diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index a873ba7af8..d4485df0b3 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -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() { diff --git a/examples/widgets/painting/affine/xform.h b/examples/widgets/painting/affine/xform.h index fff92733a0..a04381165d 100644 --- a/examples/widgets/painting/affine/xform.h +++ b/examples/widgets/painting/affine/xform.h @@ -116,7 +116,9 @@ signals: protected: void timerEvent(QTimerEvent *e); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); +#endif private: QPolygonF ctrlPoints; diff --git a/examples/widgets/widgets/mousebuttons/buttontester.cpp b/examples/widgets/widgets/mousebuttons/buttontester.cpp index 64910375dc..9a631b9fa2 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.cpp +++ b/examples/widgets/widgets/mousebuttons/buttontester.cpp @@ -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) { diff --git a/examples/widgets/widgets/mousebuttons/buttontester.h b/examples/widgets/widgets/mousebuttons/buttontester.h index bb1a7b0335..2f8db560f4 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.h +++ b/examples/widgets/widgets/mousebuttons/buttontester.h @@ -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); }; -- cgit v1.2.3