Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Swipe gesture not recognized
Hi! I'm trying to enable a swipe gesture. I created a test class like this following the documentation and the example:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
GestureLabel::GestureLabel(QWidget *parent) :
QWidget(parent)
{
grabGesture(Qt::SwipeGesture);
}
bool GestureLabel::event(QEvent *e)
{
if (e->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent*>(e));
return QWidget::event(e);
}
bool GestureLabel::gestureEvent(QGestureEvent *event)
{
if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
swipeTriggered(static_cast<QSwipeGesture *>(swipe));
return true;
}
void GestureLabel::swipeTriggered(QSwipeGesture *gesture)
{
QMessageBox::information(this, "Gesture!", "Gesture!");
}
|
Seems not to recognize swipes. I tried to put a breakpoint in line:
|
Source code
|
1
|
return gestureEvent(static_cast<QGestureEvent*>(e));
|
and seems the execution doesn't stop there. Is there anything I'm doing wrong? Am I lacking anything?
Thanks for any advice!
AFAIK Qt (QSwipeGesture etc) gestures works only in OS which supports (natively?) gestures.
Make custom one, register (as described in the documentation) and use it.
Fighting fire with fire.
Three can keep a secret if two of them are dead.
I haven't read anything about this... So, is there a list of the supported OSes? I tried under Windows Vista and Windows CE and none seems to work.
Thanks for your answer!
Fighting fire with fire.
Three can keep a secret if two of them are dead.
Uh... So gestures are not cross-platform? Gestures are available only for Windows 7?
Thanks again!