diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-08-05 14:58:50 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-08-06 09:56:46 (GMT) |
commit | 241e5cbe235953c60a6d8db2a8b6aacd909c2d28 (patch) | |
tree | 7690c795976fd6c5aada18d4ab69c25f9179ac67 /src/gui/widgets/qtextedit.cpp | |
parent | 1a97230e908193c9a260ae68635301c0e9f9f8de (diff) | |
download | Qt-241e5cbe235953c60a6d8db2a8b6aacd909c2d28.zip Qt-241e5cbe235953c60a6d8db2a8b6aacd909c2d28.tar.gz Qt-241e5cbe235953c60a6d8db2a8b6aacd909c2d28.tar.bz2 |
Enable pan gesture on all QAbstractScrollArea-based widgets.
Two-finger panning will work on all QAbstractScrollArea based widgets, however
single-finger panning will be enabled only on some special widgets that always
wants it - for example we don't want it on QGraphicsView, and we might want it
on itemviews *sometimes*.
Reviewed-by: trustme
Diffstat (limited to 'src/gui/widgets/qtextedit.cpp')
-rw-r--r-- | src/gui/widgets/qtextedit.cpp | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index c095f5c..0a41d74 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -114,7 +114,7 @@ QTextEditPrivate::QTextEditPrivate() showCursorOnInitialShow = true; inDrag = false; #ifdef Q_WS_WIN - singleFingerPanEnabled = true; + setSingleFingerPanEnabled(true); #endif } @@ -183,8 +183,6 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif - panGesture = new QPanGesture(q); - QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -2617,26 +2615,6 @@ void QTextEdit::ensureCursorVisible() d->control->ensureCursorVisible(); } -void QTextEditPrivate::_q_gestureTriggered() -{ - Q_Q(QTextEdit); - QPanGesture *g = qobject_cast<QPanGesture*>(q->sender()); - if (!g) - return; - QScrollBar *hBar = q->horizontalScrollBar(); - QScrollBar *vBar = q->verticalScrollBar(); - QSize delta = g->lastOffset(); - if (!delta.isNull()) { - if (QApplication::isRightToLeft()) - delta.rwidth() *= -1; - int newX = hBar->value() - delta.width(); - int newY = vBar->value() - delta.height(); - hbar->setValue(newX); - vbar->setValue(newY); - } -} - - /*! \enum QTextEdit::KeyboardAction |