equal
deleted
inserted
replaced
52 #include <QtCore/qstringlist.h> |
52 #include <QtCore/qstringlist.h> |
53 |
53 |
54 #include <QtGui/qevent.h> |
54 #include <QtGui/qevent.h> |
55 |
55 |
56 #include <private/qobject_p.h> |
56 #include <private/qobject_p.h> |
|
57 |
|
58 #ifndef QT_NO_GESTURES |
57 |
59 |
58 QT_BEGIN_NAMESPACE |
60 QT_BEGIN_NAMESPACE |
59 |
61 |
60 class QDeclarativeGestureAreaPrivate : public QDeclarativeItemPrivate |
62 class QDeclarativeGestureAreaPrivate : public QDeclarativeItemPrivate |
61 { |
63 { |
126 |
128 |
127 Custom gestures, handled by onGesture, will have custom properties. |
129 Custom gestures, handled by onGesture, will have custom properties. |
128 |
130 |
129 GestureArea is an invisible item: it is never painted. |
131 GestureArea is an invisible item: it is never painted. |
130 |
132 |
131 \sa Gesture, MouseArea |
133 \sa MouseArea, {declarative/touchinteraction/gestures}{Gestures example} |
132 */ |
134 */ |
133 |
135 |
134 /*! |
136 /*! |
135 \internal |
137 \internal |
136 \class QDeclarativeGestureArea |
138 \class QDeclarativeGestureArea |
224 ds >> propName; |
226 ds >> propName; |
225 int gesturetype; |
227 int gesturetype; |
226 ds >> gesturetype; |
228 ds >> gesturetype; |
227 QString script; |
229 QString script; |
228 ds >> script; |
230 ds >> script; |
229 QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), 0, script); |
231 QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), this, script); |
230 d->bindings.insert(Qt::GestureType(gesturetype),exp); |
232 d->bindings.insert(Qt::GestureType(gesturetype),exp); |
231 grabGesture(Qt::GestureType(gesturetype)); |
233 grabGesture(Qt::GestureType(gesturetype)); |
232 } |
234 } |
233 } |
235 } |
234 |
236 |
257 bool QDeclarativeGestureAreaPrivate::gestureEvent(QGestureEvent *event) |
259 bool QDeclarativeGestureAreaPrivate::gestureEvent(QGestureEvent *event) |
258 { |
260 { |
259 bool accept = true; |
261 bool accept = true; |
260 for (Bindings::Iterator it = bindings.begin(); it != bindings.end(); ++it) { |
262 for (Bindings::Iterator it = bindings.begin(); it != bindings.end(); ++it) { |
261 if ((gesture = event->gesture(it.key()))) { |
263 if ((gesture = event->gesture(it.key()))) { |
262 it.value()->evaluate(); |
264 QDeclarativeExpression *expr = it.value(); |
|
265 expr->evaluate(); |
|
266 if (expr->hasError()) |
|
267 qmlInfo(q_func()) << expr->error(); |
263 event->setAccepted(true); // XXX only if value returns true? |
268 event->setAccepted(true); // XXX only if value returns true? |
264 } |
269 } |
265 } |
270 } |
266 return accept; |
271 return accept; |
267 } |
272 } |
268 |
273 |
269 QT_END_NAMESPACE |
274 QT_END_NAMESPACE |
|
275 |
|
276 #endif // QT_NO_GESTURES |