Hi.
In QPlainTextEdit::event( QEvent * e )
I've found the next code:
#ifndefQT_NO_GESTURES
else if (e->type() == QEvent::Gesture) {
QGestureEvent *ge = static_cast<QGestureEvent *>(e);
QPanGesture *g = static_cast<QPanGesture
*>(ge->gesture(Qt::PanGesture));
if (g) {
QScrollBar *hBar = horizontalScrollBar();
QScrollBar *vBar = verticalScrollBar();
if (g->state() == Qt::GestureStarted)
d->originalOffsetY = vBar->value();
QPointF offset = g->offset();
if (!offset.isNull()) {
if (QApplication::isRightToLeft())
offset.rx() *= -1;
// QPlainTextEdit scrolls by lines only in vertical
direction
QFontMetrics fm(document()->defaultFont());
int lineHeight = fm.height();
int newX = hBar->value() - g->delta().x();
int newY = d->originalOffsetY - offset.y()/lineHeight;
hBar->setValue(newX);
vBar->setValue(newY);
}
}
return true;
}
#endif // QT_NO_GESTURES
It told to me that QPlainTextEdit should support "pan gesture" and text should
be paned with
fingers. But in my test app when I move finger in QPlainTextEdit I receive
selection of the text.
And I saw that in event( QEvent * e ) method appear QEvent::InputMethodQuery
event instead of
QEvent::Gesture.
But with two fingers I receive sometimes QEvent::Gesture and text scrolled but
in wrong direction.
It's ugly to not to have scrolling with one finger. May be we should post
suggestion to the
bugreports.qt-project.org?
Any ideas?!
Sorry. Direction is correct.
Hi,
sorry for 3rd posting about same issue. I didn't know the right
mailing list.
I have tried it several hours and get only a pan gesture with two
fingers,
with text selection (what I not want).
I have used QPlainTextEdit, QTextEdit - with Qt Designer or subclass
(grabGesture(Qt::PanGesture)) -
in a simple 'MainWindow' (c++).
(I have tried the gesture source code from the QPLainTextEdit 'event'
function.)
I got never the result like with the 'aboutQt' (QMessageBox) call.
I have Installed:
Qt 5.2.0 for Android (Windows 32-bit, 761 MB),
Asus MeMO Pad HD 7 (Android 4.2.2),
Samsung Galaxy S4 mini (Android 4.2.2)
I want to show results in a QPlainTextEdit or QTextEdit without text
selection, but pan
up and down (and it would be nice, left and right).
Can somebody help me, please?
Thanks,
Thomas
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest
--
Best Regards,
Igor Mironchik.
--
Best Regards,
Igor Mironchik.
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest