diff -r 2b1b11a301d2 -r 4b195f3bea29 homescreenapp/widgetplugins/hsclockwidgetplugin/src/hsanalogclockwidget.cpp --- a/homescreenapp/widgetplugins/hsclockwidgetplugin/src/hsanalogclockwidget.cpp Tue Jul 06 14:06:53 2010 +0300 +++ b/homescreenapp/widgetplugins/hsclockwidgetplugin/src/hsanalogclockwidget.cpp Wed Aug 18 09:40:07 2010 +0300 @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include "hsconfiguration.h" @@ -38,12 +38,13 @@ HsAnalogClockWidget::HsAnalogClockWidget(QGraphicsItem *parent) : HbWidget(parent), mBackground(0), mHourHand(0), mMinuteHand(0), - mSecondHand(0), mTouchArea(0) + mSecondHand(0) { HbStyleLoader::registerFilePath(":/hsanalogclockwidget.widgetml"); HbStyleLoader::registerFilePath(":/hsanalogclockwidget.css"); createPrimitives(); + grabGesture(Qt::TapGesture); } /*! @@ -53,28 +54,27 @@ { HbStyleLoader::unregisterFilePath(":/hsanalogclockwidget.widgetml"); HbStyleLoader::unregisterFilePath(":/hsanalogclockwidget.css"); - mTouchArea->removeEventFilter(this); } -/*! - Filters touch area events. -*/ -bool HsAnalogClockWidget::eventFilter(QObject *watched, QEvent *event) +#ifdef COVERAGE_MEASUREMENT +#pragma CTC SKIP +#endif //COVERAGE_MEASUREMENT +void HsAnalogClockWidget::gestureEvent(QGestureEvent *event) { - Q_UNUSED(watched) + HbTapGesture *gesture = qobject_cast(event->gesture(Qt::TapGesture)); + if (gesture) { + if (gesture->state() == Qt::GestureFinished) { + if (gesture->tapStyleHint() == HbTapGesture::Tap) { + HbInstantFeedback::play(HSCONFIGURATION_GET(clockWidgetTapFeedbackEffect)); + emit clockTapped(); + } + } + } +} +#ifdef COVERAGE_MEASUREMENT +#pragma CTC ENDSKIP +#endif //COVERAGE_MEASUREMENT - switch (event->type()) { - case QEvent::GraphicsSceneMousePress: - return true; - case QEvent::GraphicsSceneMouseRelease: - handleMouseReleaseEvent(static_cast(event)); - return true; - default: - break; - } - - return false; -} /*! Return bounding rect @@ -130,10 +130,6 @@ mSecondHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_sec"), this); HbStyle::setItemName(mSecondHand, QLatin1String("second_hand")); - - mTouchArea = new HbTouchArea(this); - mTouchArea->installEventFilter(this); - HbStyle::setItemName(mTouchArea, QLatin1String("toucharea")); } /*! @@ -160,17 +156,3 @@ mSecondHand->setTransformOriginPoint(originPoint); mSecondHand->setRotation(s); } - -/*! - \internal -*/ -void HsAnalogClockWidget::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (!contains(event->pos())) { - return; - } - - HbInstantFeedback::play(HSCONFIGURATION_GET(clockWidgetTapFeedbackEffect)); - - emit clockTapped(); -}