--- a/src/hbwidgets/sliders/hbzoomslider_p.cpp Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbwidgets/sliders/hbzoomslider_p.cpp Fri Sep 17 08:32:10 2010 +0300
@@ -31,6 +31,9 @@
#include "hbslidercontrol_p.h"
#include <QGraphicsSceneEvent>
#include <QGraphicsScene>
+#ifdef HB_GESTURE_FW
+#include <hbtapgesture.h>
+#endif
/*!
Example usage:
@@ -123,6 +126,9 @@
<< HbSlider::DecreaseElement
<< HbSlider::TextElement;
setElements( elements );
+#ifdef HB_GESTURE_FW
+ q->grabGesture(Qt::TapGesture);
+#endif
// create element because HbSlider will not create element for NULL Icon
// and zoom slider Icon is set in style
@@ -249,6 +255,7 @@
*/
void HbZoomSlider::mousePressEvent( QGraphicsSceneMouseEvent *event )
{
+#ifndef HB_GESTURE_FW
Q_D( HbZoomSlider );
if( d->elementItemMap.contains(HbSlider::IncreaseElement) ) {
if ( d->elementItemMap[HbSlider::IncreaseElement].touchItem->isUnderMouse( ) ) {
@@ -266,6 +273,9 @@
}
HbSlider::mousePressEvent( event );
+#else
+ Q_UNUSED(event)
+#endif
}
/*!
@@ -274,12 +284,62 @@
*/
void HbZoomSlider::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
{
+#ifndef HB_GESTURE_FW
Q_D( HbZoomSlider );
HbSlider::mouseReleaseEvent( event );
d->stopRepeatAction( );
setProperty("changeincrementState" ,false);
setProperty("changedecrementState" ,false);
setProperty("state", "normal");
+#else
+ Q_UNUSED (event)
+#endif
+}
+/*!
+ \reimp
+ */
+void HbZoomSlider::gestureEvent(QGestureEvent *event)
+{
+ Q_D(HbZoomSlider);
+ //consume the event if gesture is on increment or decrement
+ if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {
+ QPointF pos = event->mapToGraphicsScene(tap->position());
+ switch( tap->state( ) ) {
+ case Qt::GestureStarted: {
+ if ( d->elementItemMap.contains (HbSlider::IncreaseElement ) ) {
+ if (d->elementItemMap[HbSlider::IncreaseElement].touchItem ) {
+ if (d->elementItemMap[HbSlider::IncreaseElement].touchItem->sceneBoundingRect().contains(pos)) {
+ setProperty("changeincrementState" ,true);
+ setProperty("changedecrementState" ,false);
+ setProperty("state", "pressed");
+
+ }
+ }
+ }
+ if ( d->elementItemMap.contains (HbSlider::DecreaseElement ) ) {
+ if (d->elementItemMap[HbSlider::DecreaseElement].touchItem ) {
+ if (d->elementItemMap[HbSlider::DecreaseElement].touchItem->sceneBoundingRect().contains(pos)) {
+ setProperty("changeincrementState" ,false);
+ setProperty("changedecrementState" ,true);
+ setProperty("state", "pressed");
+ }
+ }
+ }
+ }
+ break;
+ case Qt::GestureCanceled:
+ case Qt::GestureFinished: {
+ setProperty("changeincrementState" ,false);
+ setProperty("changedecrementState" ,false);
+ setProperty("state", "normal");
+ }
+ default:
+ break;
+
+
+ }
+ }
+ HbSlider::gestureEvent(event);
}
/*!