268 } |
268 } |
269 } |
269 } |
270 #ifdef HB_GESTURE_FW |
270 #ifdef HB_GESTURE_FW |
271 void HbMenuItem::gestureEvent(QGestureEvent *event) |
271 void HbMenuItem::gestureEvent(QGestureEvent *event) |
272 { |
272 { |
273 //Q_D(HbMenuItem); |
|
274 if(HbTapGesture *gesture = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) { |
273 if(HbTapGesture *gesture = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) { |
275 if (gesture->state() == Qt::GestureStarted) { |
274 if (gesture->state() == Qt::GestureStarted) { |
276 if (scene()) |
275 if (scene()) { |
277 scene()->setProperty(HbPrivate::OverridingGesture.latin1(),Qt::TapGesture); |
276 scene()->setProperty(HbPrivate::OverridingGesture.latin1(),Qt::TapGesture); |
|
277 } |
278 gesture->setProperty(HbPrivate::ThresholdRect.latin1(), mapRectToScene(boundingRect()).toRect()); |
278 gesture->setProperty(HbPrivate::ThresholdRect.latin1(), mapRectToScene(boundingRect()).toRect()); |
279 |
|
280 // Tactile feedback |
|
281 HbWidgetFeedback::triggered(this, Hb::InstantPressed); |
279 HbWidgetFeedback::triggered(this, Hb::InstantPressed); |
282 |
|
283 pressStateChanged(true); |
280 pressStateChanged(true); |
284 event->accept(); |
281 event->accept(); |
285 } else if (gesture->state() == Qt::GestureFinished) { |
282 } else if (gesture->state() == Qt::GestureFinished) { |
286 if (scene()) |
283 if (scene()) { |
287 scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant()); |
284 scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant()); |
|
285 } |
288 HbWidgetFeedback::triggered(this, Hb::InstantReleased); |
286 HbWidgetFeedback::triggered(this, Hb::InstantReleased); |
289 pressStateChanged(false); |
287 pressStateChanged(false); |
290 event->accept(); |
288 event->accept(); |
291 HbMenuPrivate::d_ptr(menu())->_q_triggerAction(this); |
289 HbMenuPrivate::d_ptr(menu())->_q_triggerAction(this); |
292 } else if (gesture->state() == Qt::GestureCanceled) { |
290 } else if (gesture->state() == Qt::GestureCanceled) { |
293 if (scene()) |
291 if (scene()) { |
294 scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant()); |
292 scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant()); |
|
293 } |
295 pressStateChanged(false); |
294 pressStateChanged(false); |
296 } |
295 } |
297 } |
296 } |
298 } |
297 } |
299 #endif |
298 #endif |
387 HbFrameItem *focusItem = qgraphicsitem_cast<HbFrameItem*>(d->mFocusItem); |
386 HbFrameItem *focusItem = qgraphicsitem_cast<HbFrameItem*>(d->mFocusItem); |
388 if(focusItem){ |
387 if(focusItem){ |
389 focusItem->setGeometry(boundingRect()); |
388 focusItem->setGeometry(boundingRect()); |
390 } |
389 } |
391 } else if (d->mFocusItem){ |
390 } else if (d->mFocusItem){ |
|
391 // hide() is required below in case there is a gesture |
|
392 // cancellation going on. Without hide() the highlight is not |
|
393 // removed. |
|
394 d->mFocusItem->hide(); |
392 delete d->mFocusItem; |
395 delete d->mFocusItem; |
393 d->mFocusItem = 0; |
396 d->mFocusItem = 0; |
394 } |
397 } |
395 } |
398 } |
396 |
399 |