diff options
-rw-r--r-- | src/gui/kernel/qgesture.cpp | 45 | ||||
-rw-r--r-- | src/gui/kernel/qgesture.h | 14 | ||||
-rw-r--r-- | src/gui/kernel/qgesture_p.h | 11 | ||||
-rw-r--r-- | src/gui/kernel/qstandardgestures.cpp | 43 | ||||
-rw-r--r-- | src/gui/kernel/qstandardgestures.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/qtextedit.cpp | 8 |
6 files changed, 6 insertions, 118 deletions
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 1f98013..32ac4f8 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -205,51 +205,6 @@ void QGesture::setState(Qt::GestureState state) } /*! - \property QGesture::startPos - - \brief The start position of the gesture (if relevant). -*/ -QPoint QGesture::startPos() const -{ - return d_func()->startPos; -} - -void QGesture::setStartPos(const QPoint &point) -{ - d_func()->startPos = point; -} - -/*! - \property QGesture::lastPos - - \brief The last recorded position of the gesture (if relevant). -*/ -QPoint QGesture::lastPos() const -{ - return d_func()->lastPos; -} - -void QGesture::setLastPos(const QPoint &point) -{ - d_func()->lastPos = point; -} - -/*! - \property QGesture::pos - - \brief The current position of the gesture (if relevant). -*/ -QPoint QGesture::pos() const -{ - return d_func()->pos; -} - -void QGesture::setPos(const QPoint &point) -{ - d_func()->pos = point; -} - -/*! Sets the \a graphicsItem the gesture is filtering events for. The gesture will install an event filter to the \a graphicsItem and diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 1cd9cae..0735160 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -64,10 +64,6 @@ class Q_GUI_EXPORT QGesture : public QObject Q_PROPERTY(Qt::GestureState state READ state) - Q_PROPERTY(QPoint startPos READ startPos WRITE setStartPos) - Q_PROPERTY(QPoint lastPos READ lastPos WRITE setLastPos) - Q_PROPERTY(QPoint pos READ pos WRITE setPos) - public: explicit QGesture(QObject *parent = 0); ~QGesture(); @@ -80,19 +76,13 @@ public: virtual void reset(); Qt::GestureState state() const; - void setState(Qt::GestureState state); - - QPoint startPos() const; - void setStartPos(const QPoint &point); - QPoint lastPos() const; - void setLastPos(const QPoint &point); - QPoint pos() const; - void setPos(const QPoint &point); protected: QGesture(QGesturePrivate &dd, QObject *parent); bool eventFilter(QObject*, QEvent*); + void setState(Qt::GestureState state); + Q_SIGNALS: void started(); void triggered(); diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 99f572f..56eaee7 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -73,22 +73,11 @@ public: { } - void init(const QPoint &startPos, const QPoint &lastPos, - const QPoint &pos) - { - this->startPos = startPos; - this->lastPos = lastPos; - this->pos = pos; - } QGraphicsItem *graphicsItem; QGraphicsItem *eventFilterProxyGraphicsItem; Qt::GestureState state; - - QPoint startPos; - QPoint lastPos; - QPoint pos; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index e4b9abb..4753416 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -269,13 +269,8 @@ void QPanGesture::reset() */ QSize QPanGesture::totalOffset() const { -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) Q_D(const QPanGesture); return d->totalOffset; -#else - QPoint pt = pos() - startPos(); - return QSize(pt.x(), pt.y()); -#endif } /*! @@ -286,46 +281,8 @@ QSize QPanGesture::totalOffset() const */ QSize QPanGesture::lastOffset() const { -#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) Q_D(const QPanGesture); return d->lastOffset; -#else - QPoint pt = pos() - lastPos(); - return QSize(pt.x(), pt.y()); -#endif -} - -/*! - \property QPanGesture::startPos - - \brief The start position of the gesture. -*/ -QPoint QPanGesture::startPos() const -{ - Q_D(const QPanGesture); - return d->startPos; -} - -/*! - \property QPanGesture::lastPos - - \brief The last recorded position of the gesture. -*/ -QPoint QPanGesture::lastPos() const -{ - Q_D(const QPanGesture); - return d->lastPos; -} - -/*! - \property QPanGesture::pos - - \brief The current position of the gesture. -*/ -QPoint QPanGesture::pos() const -{ - Q_D(const QPanGesture); - return d->pos; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h index c6f6d9b..c734fba 100644 --- a/src/gui/kernel/qstandardgestures.h +++ b/src/gui/kernel/qstandardgestures.h @@ -70,9 +70,6 @@ public: QSize totalOffset() const; QSize lastOffset() const; - QPoint startPos() const; - QPoint lastPos() const; - QPoint pos() const; private: bool event(QEvent *event); diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index e80df92..c095f5c 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -2625,12 +2625,12 @@ void QTextEditPrivate::_q_gestureTriggered() return; QScrollBar *hBar = q->horizontalScrollBar(); QScrollBar *vBar = q->verticalScrollBar(); - QPoint delta = g->pos() - (g->lastPos().isNull() ? g->pos() : g->lastPos()); + QSize delta = g->lastOffset(); if (!delta.isNull()) { if (QApplication::isRightToLeft()) - delta.rx() *= -1; - int newX = hBar->value() - delta.x(); - int newY = vBar->value() - delta.y(); + delta.rwidth() *= -1; + int newX = hBar->value() - delta.width(); + int newY = vBar->value() - delta.height(); hbar->setValue(newX); vbar->setValue(newY); } |