Fix compile with -DQT_NO_WHEELEVENT
Change-Id: Icc345e2a361fc233d7debfa88bef2a3a8375fa8f Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
422b8dd24e
commit
f775f6dd88
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -60,7 +60,9 @@ public:
|
||||
GraphicsView(View *v) : QGraphicsView(), view(v) { }
|
||||
|
||||
protected:
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent(QWheelEvent *);
|
||||
#endif
|
||||
|
||||
private:
|
||||
View *view;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -116,7 +116,9 @@ signals:
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *e);
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent(QWheelEvent *);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QPolygonF ctrlPoints;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user