diff options
Diffstat (limited to 'src/imports/gestures')
-rw-r--r-- | src/imports/gestures/plugin.cpp | 7 | ||||
-rw-r--r-- | src/imports/gestures/qdeclarativegesturearea.cpp | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/imports/gestures/plugin.cpp b/src/imports/gestures/plugin.cpp index 1fc23ca..8f85553 100644 --- a/src/imports/gestures/plugin.cpp +++ b/src/imports/gestures/plugin.cpp @@ -55,6 +55,13 @@ public: Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.gestures")); #ifndef QT_NO_GESTURES qmlRegisterCustomType<QDeclarativeGestureArea>(uri,1,0, "GestureArea", new QDeclarativeGestureAreaParser); + + qmlRegisterUncreatableType<QGesture>(uri, 1, 0, "Gesture", QLatin1String("Do not create objects of this type.")); + qmlRegisterUncreatableType<QPanGesture>(uri, 1, 0, "PanGesture", QLatin1String("Do not create objects of this type.")); + qmlRegisterUncreatableType<QTapGesture>(uri, 1, 0, "TapGesture", QLatin1String("Do not create objects of this type.")); + qmlRegisterUncreatableType<QTapAndHoldGesture>(uri, 1, 0, "TapAndHoldGesture", QLatin1String("Do not create objects of this type.")); + qmlRegisterUncreatableType<QPinchGesture>(uri, 1, 0, "PinchGesture", QLatin1String("Do not create objects of this type.")); + qmlRegisterUncreatableType<QSwipeGesture>(uri, 1, 0, "SwipeGesture", QLatin1String("Do not create objects of this type.")); #endif } }; diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index 243ba0f..ed936d5 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -228,7 +228,7 @@ void QDeclarativeGestureArea::connectSignals() ds >> gesturetype; QString script; ds >> script; - QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), 0, script); + QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), this, script); d->bindings.insert(Qt::GestureType(gesturetype),exp); grabGesture(Qt::GestureType(gesturetype)); } @@ -261,7 +261,10 @@ bool QDeclarativeGestureAreaPrivate::gestureEvent(QGestureEvent *event) bool accept = true; for (Bindings::Iterator it = bindings.begin(); it != bindings.end(); ++it) { if ((gesture = event->gesture(it.key()))) { - it.value()->evaluate(); + QDeclarativeExpression *expr = it.value(); + expr->evaluate(); + if (expr->hasError()) + qmlInfo(q_func()) << expr->error(); event->setAccepted(true); // XXX only if value returns true? } } |