src/hbwidgets/sliders/hbslidercontrol.cpp
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    27 #include "hbslidercontrol_p_p.h"
    27 #include "hbslidercontrol_p_p.h"
    28 #include "hbabstractslidercontrol_p.h"
    28 #include "hbabstractslidercontrol_p.h"
    29 #include "hbsliderhandle_p.h"
    29 #include "hbsliderhandle_p.h"
    30 #include "hbstyleoptionslider_p.h"
    30 #include "hbstyleoptionslider_p.h"
    31 #include "hbslidertickmarkslabel_p.h"
    31 #include "hbslidertickmarkslabel_p.h"
       
    32 #include "hbstyle_p.h"
    32 #include <hbstyle.h>
    33 #include <hbstyle.h>
    33 #include <hbinstance.h>
    34 #include <hbinstance.h>
    34 #include <hbtheme.h>
    35 #include <hbtheme.h>
    35 #include <hbtooltip.h>
    36 #include <hbtooltip.h>
    36 #include <hbwidgetfeedback.h>
    37 #include <hbwidgetfeedback.h>
    37 #include <hbgraphicsscene.h>
    38 #include <hbgraphicsscene.h>
       
    39 #include <hbtoucharea.h>
       
    40 #include <hbslider.h>
    38 #include <QGraphicsItem>
    41 #include <QGraphicsItem>
    39 #include <QGraphicsSceneMouseEvent>
    42 #include <QGraphicsSceneMouseEvent>
    40 #ifdef HB_GESTURE_FW
    43 #ifdef HB_GESTURE_FW
    41 #include "hbtapgesture.h"
    44 #include "hbtapgesture.h"
    42 #include "hbpangesture.h"
    45 #include "hbpangesture.h"
       
    46 #include "hbtapandholdgesture.h"
       
    47 
    43 #endif 
    48 #endif 
    44 
    49 
    45 #ifdef HB_EFFECTS
    50 #ifdef HB_EFFECTS
    46 #include "hbeffect.h"
    51 #include "hbeffect.h"
    47 #include "hbeffectinternal_p.h"
    52 #include "hbeffectinternal_p.h"
    60     majorTickInterval( 0 ),// major tick interval
    65     majorTickInterval( 0 ),// major tick interval
    61     minorTickInterval( 0 ),// minor tick interval
    66     minorTickInterval( 0 ),// minor tick interval
    62     groove( 0 ), //slider groove
    67     groove( 0 ), //slider groove
    63     progressGroove( 0 ),//progress mask top of groove
    68     progressGroove( 0 ),//progress mask top of groove
    64     displayCurrValueToolTip( true ), // holds whether to show current value tooltip or not
    69     displayCurrValueToolTip( true ), // holds whether to show current value tooltip or not
    65     toolTipAlignment( Qt::AlignTop|Qt::AlignRight ), // tooltip alignment
    70     toolTipAlignment( Qt::AlignTop ), // tooltip alignment
    66     groovePressed( false ), // hold whether groove is pressed or not
    71     groovePressed( false ), // hold whether groove is pressed or not
    67     setDefault( false ), // holds whther default value for track press is set
    72     setDefault( false ), // holds whther default value for track press is set
    68     previousValue( 0 ),  // default value for track press
    73     previousValue( 0 ),  // default value for track press
    69     trackHandlingEnable( false ),// this variable holds whether track will be interective or not
    74     trackHandlingEnable( false ),// this variable holds whether track will be interective or not
    70     handleMoving( false ),
    75     handleMoving( false ),
    71     grooveTouchArea ( 0 ),
    76     grooveTouchArea ( 0 ),
    72     enableProgressTrack ( true ),
    77     enableProgressTrack ( true ),
    73     userDefinedTooltipAlign ( false )
    78     userDefinedTooltipAlign ( false ),
       
    79     tooltipArea(0),
       
    80     tooltipBorderHeight( 0 )
    74 {
    81 {
    75 
    82 
    76     majorLabel.clear();
    83     majorLabel.clear();
    77     minorLabel.clear();
    84     minorLabel.clear();
    78     
    85     
    96    
   103    
    97     q->enableTrackEventHandling( true );
   104     q->enableTrackEventHandling( true );
    98    
   105    
    99     // creating handle
   106     // creating handle
   100     handle = createHandle();
   107     handle = createHandle();
   101     if(handle) {
   108     if (handle) {
   102         HbStyle::setItemName( handle, "handle" );
   109         HbStyle::setItemName( handle, "handle" );
   103     }
   110     }
   104 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )    
   111 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )    
   105     q->setFocusPolicy( Qt::FocusPolicy( ( qApp->style( ) )->styleHint( QStyle::SH_Button_FocusPolicy ) ) );
   112     q->setFocusPolicy( Qt::FocusPolicy( ( qApp->style( ) )->styleHint( QStyle::SH_Button_FocusPolicy ) ) );
   106 #endif
   113 #endif
   107     groove = createGroove();
   114     groove = createGroove();
   108     if(groove) {
   115     if (groove) {
   109         HbStyle::setItemName( groove, "groove" );
   116         HbStyle::setItemName( groove, "groove" );
   110     }
   117     }
   111 #ifdef HB_GESTURE_FW
   118 #ifdef HB_GESTURE_FW
   112     q->setFiltersChildEvents(true) ;
   119     q->setFiltersChildEvents(true) ;
   113 #endif
   120 #endif
   114 
   121 
   115     //filled item top of groove
   122     //filled item top of groove
   116     if ( enableProgressTrack ) {
   123     if ( enableProgressTrack ) {
   117         progressGroove = createProgressGroove();
   124         progressGroove = createProgressGroove();
   118         if(progressGroove) {
   125         if (progressGroove) {
   119             HbStyle::setItemName( progressGroove, "progressgroove");
   126             HbStyle::setItemName( progressGroove, "progressgroove");
   120         }    
   127         }    
   121     }
   128     }
       
   129     tooltipArea = new HbTouchArea(q);
   122     q->connect( hbInstance->theme( ), SIGNAL( changed( ) ), q, SLOT( updateTheme( ) ) );
   130     q->connect( hbInstance->theme( ), SIGNAL( changed( ) ), q, SLOT( updateTheme( ) ) );
   123     q->connect( q , SIGNAL( actionTriggered( int ) ), q , SLOT( showToolTip( ) ) );
   131  //   q->connect( q , SIGNAL( actionTriggered( int ) ), q , SLOT( showToolTip( ) ) );
   124     q->connect( q , SIGNAL( sliderReleased( ) ), q , SLOT( hideToolTip( ) ) );
   132     q->connect( q , SIGNAL( sliderReleased( ) ), q , SLOT( hideToolTip( ) ) );
   125 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )
   133 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )
   126     q->setFlags( QGraphicsItem::ItemIsFocusable );
   134     q->setFlags( QGraphicsItem::ItemIsFocusable );
   127 #endif
   135 #endif
   128 }
   136 }
   129 
   137 
   130 
   138 int HbSliderControlPrivate::calculateSliderPosition(QPointF relativePos) 
       
   139 {
       
   140     Q_Q (HbSliderControl);
       
   141     qreal span = 0;
       
   142     qreal handlePos = 0;
       
   143     QRectF bounds = q->boundingRect( );
       
   144     QRectF handleBounds = handle->boundingRect( );
       
   145     bounds.adjust( 0, 0, -handleBounds.width( ), -handleBounds.height( ) );
       
   146     // calculate handle position and span
       
   147     switch ( q->orientation( ) ) {
       
   148         case Qt::Horizontal:
       
   149             handlePos = relativePos.x( ) - handleBounds.width( ) / 2;
       
   150             span = bounds.width( );
       
   151             break;
       
   152         case Qt::Vertical:
       
   153             handlePos = relativePos.y( ) - handleBounds.height( ) / 2;
       
   154             span = bounds.height( );
       
   155             break;
       
   156         default:
       
   157             break;
       
   158     }
       
   159     HbStyleOptionSlider opt;
       
   160     q->initStyleOption( &opt );
       
   161     int pressValue = QStyle::sliderValueFromPosition( opt.minimum, opt.maximum,
       
   162         static_cast<int>( handlePos ),static_cast<int>( span ),opt.upsideDown );
       
   163     return pressValue;
       
   164 
       
   165 
       
   166 }
   131 
   167 
   132 /*!
   168 /*!
   133   \internal
   169   \internal
   134   This is used to create the handle, it is virtual and can be overridden to create different handle.
   170   This is used to create the handle, it is virtual and can be overridden to create different handle.
   135   */
   171   */
   145   This is used to create the groove.It can be overrideen by derived class
   181   This is used to create the groove.It can be overrideen by derived class
   146   */
   182   */
   147 QGraphicsItem *HbSliderControlPrivate::createGroove()
   183 QGraphicsItem *HbSliderControlPrivate::createGroove()
   148 {
   184 {
   149     Q_Q( HbSliderControl );
   185     Q_Q( HbSliderControl );
   150     QGraphicsItem *groove = qgraphicsitem_cast<QGraphicsItem*>( q->style( )->createPrimitive(
   186     QGraphicsItem *groove = qgraphicsitem_cast<QGraphicsItem*>( HbStylePrivate::createPrimitive(
   151         HbStyle::P_Slider_groove, q ) );
   187         HbStylePrivate::P_Slider_groove, q ) );
   152     return groove;
   188     return groove;
   153 }
   189 }
   154 /*!
   190 /*!
   155   \internal
   191   \internal
   156   This is used to create the masked progress groove.This can be overrideen by derived class
   192   This is used to create the masked progress groove.This can be overrideen by derived class
   157   */
   193   */
   158 QGraphicsItem *HbSliderControlPrivate::createProgressGroove()
   194 QGraphicsItem *HbSliderControlPrivate::createProgressGroove()
   159 {
   195 {
   160     Q_Q( HbSliderControl );
   196     Q_Q( HbSliderControl );
   161     QGraphicsItem *proggroove = qgraphicsitem_cast<QGraphicsItem*>( q->style( )->createPrimitive(
   197     QGraphicsItem *proggroove = qgraphicsitem_cast<QGraphicsItem*>( HbStylePrivate::createPrimitive(
   162         HbStyle::P_Slider_progressgroove, q ) );//comes on top of groove
   198         HbStylePrivate::P_Slider_progressgroove, q ) );//comes on top of groove
   163     return proggroove;
   199     return proggroove;
   164 }
   200 }
   165 
   201 
   166 /*!
   202 /*!
   167    This api adjust the handle within slider area
   203    This api adjust the handle within slider area
   199     }
   235     }
   200     //set handle position
   236     //set handle position
   201     handle->forceSetPos( rect.topLeft( ) );
   237     handle->forceSetPos( rect.topLeft( ) );
   202     //progress groove should be adjusted whenever handle position is changed
   238     //progress groove should be adjusted whenever handle position is changed
   203     if ( progressGroove ) {
   239     if ( progressGroove ) {
   204         q->style( )->updatePrimitive( progressGroove, HbStyle::P_Slider_progressgroove, &opt );
   240         HbStylePrivate::updatePrimitive( progressGroove, HbStylePrivate::P_Slider_progressgroove, &opt );
   205     }
   241     }
   206 }
   242 }
   207 
   243 
   208 /*!
   244 /*!
   209    This api returns true if pos in on handle boundingRect
   245    This api returns true if pos in on handle boundingRect
   299 
   335 
   300 /*!
   336 /*!
   301   Protected constructor for initialization from derived ctor.
   337   Protected constructor for initialization from derived ctor.
   302 */
   338 */
   303 HbSliderControl::HbSliderControl(HbSliderControlPrivate &dd,QGraphicsItem *parent)
   339 HbSliderControl::HbSliderControl(HbSliderControlPrivate &dd,QGraphicsItem *parent)
   304 	:HbAbstractSliderControl(dd,parent)
   340     :HbAbstractSliderControl(dd,parent)
   305 {
   341 {
   306 }
   342 }
   307 
   343 
   308 /*!
   344 /*!
   309     When theme is changed this is called.
   345     When theme is changed this is called.
   594 
   630 
   595 */
   631 */
   596 void HbSliderControl::showToolTip( )
   632 void HbSliderControl::showToolTip( )
   597 {
   633 {
   598     Q_D( HbSliderControl );
   634     Q_D( HbSliderControl );
   599     if ( isSliderDown( ) && d->displayCurrValueToolTip ) {
   635     if ( d->displayCurrValueToolTip ) {
   600         HbToolTip::showText( toolTip( ) , d->handle->primitive(HbStyle::P_SliderElement_touchhandle) , d->toolTipAlignment );
   636         QRectF handleRect=d->handle->boundingRect();
   601     }
   637         QRectF tooltipRect = handleRect;
       
   638         tooltipRect.setHeight ( d->tooltipBorderHeight);
       
   639         tooltipRect.moveBottom( d->handle->pos().ry());
       
   640         tooltipRect.moveLeft (d->handle->pos().rx());
       
   641         d->tooltipArea->setGeometry(tooltipRect);
       
   642         //d->tooltipArea->update();*/
       
   643         HbToolTip::showText( toolTip( ) , d->tooltipArea, d->toolTipAlignment );
       
   644        }
       
   645 
       
   646 
   602 }
   647 }
   603 
   648 
   604 /*!
   649 /*!
   605   reimp
   650   reimp
   606 
   651 
   635     if ( !eventRect.contains( event->scenePos( ) ) ) {
   680     if ( !eventRect.contains( event->scenePos( ) ) ) {
   636         event->ignore( );
   681         event->ignore( );
   637         return;
   682         return;
   638     }
   683     }
   639     event->accept( );
   684     event->accept( );
   640     if( d->onHandle( event->scenePos( ) ) ) {
   685     if ( d->onHandle( event->scenePos( ) ) ) {
   641         HbWidgetFeedback::triggered( this, Hb::InstantPressed, Hb::ModifierSliderHandle );
   686         HbWidgetFeedback::triggered( this, Hb::InstantPressed, Hb::ModifierSliderHandle );
   642         setSliderDown( true );
   687         setSliderDown( true );
   643         d->handle->updatePrimitives( );
   688         d->handle->updatePrimitives( );
   644         d->handleMoving = true;
   689         d->handleMoving = true;
   645     }
   690     }
   646     else {
   691     else {
   647     // effect
   692     // effect
   648 #ifdef HB_EFFECTS
   693 #ifdef HB_EFFECTS
   649     if( d->grooveTouchArea->sceneBoundingRect( ).contains( event->scenePos( ) ) ) {
   694     if ( d->grooveTouchArea->sceneBoundingRect( ).contains( event->scenePos( ) ) ) {
   650         if( orientation( ) == Qt::Horizontal ) {   
   695         if ( orientation( ) == Qt::Horizontal ) {   
   651         // effect for horizontal track press
   696         // effect for horizontal track press
   652             HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackpress", "h_trackpress" );
   697             HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackpress", "h_trackpress" );
   653             HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrpress" );
   698             HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrpress" );
   654         }
   699         }
   655         else {
   700         else {
   679         initStyleOption( &opt );
   724         initStyleOption( &opt );
   680         // calculate pixel value for event position
   725         // calculate pixel value for event position
   681         int pressValue = QStyle::sliderValueFromPosition( opt.minimum, opt.maximum,
   726         int pressValue = QStyle::sliderValueFromPosition( opt.minimum, opt.maximum,
   682             static_cast<int>( handlePos ),static_cast<int>( span ),opt.upsideDown );
   727             static_cast<int>( handlePos ),static_cast<int>( span ),opt.upsideDown );
   683         //update the groove and touch item
   728         //update the groove and touch item
   684         style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );  
   729         HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );  
   685         // if default is set then do not increment or decrement slider value
   730         // if default is set then do not increment or decrement slider value
   686         // just set default value to slider
   731         // just set default value to slider
   687         if ( d->setDefault ) {
   732         if ( d->setDefault ) {
   688             setValue( d->previousValue );
   733             setValue( d->previousValue );
   689             if ( pressValue > value( ) ) {
   734             if ( pressValue > value( ) ) {
   740 #endif
   785 #endif
   741         HbStyleOptionSlider opt;
   786         HbStyleOptionSlider opt;
   742         d->groovePressed = false;
   787         d->groovePressed = false;
   743         initStyleOption( &opt );    
   788         initStyleOption( &opt );    
   744         // update primitive from press to normal
   789         // update primitive from press to normal
   745         style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );
   790         HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );
   746     }
   791     }
   747     if ( event->buttons( ) ) {
   792     if ( event->buttons( ) ) {
   748         event->ignore( );
   793         event->ignore( );
   749         return;
   794         return;
   750     }
   795     }
   778 */
   823 */
   779 #ifdef HB_GESTURE_FW
   824 #ifdef HB_GESTURE_FW
   780 void HbSliderControl::gestureEvent(QGestureEvent *event)
   825 void HbSliderControl::gestureEvent(QGestureEvent *event)
   781 {
   826 {
   782     Q_D(HbSliderControl);
   827     Q_D(HbSliderControl);
   783     if(HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {
   828     if ( HbTapAndHoldGesture *tapandHold = qobject_cast<HbTapAndHoldGesture *> ( event->gesture( Qt::TapAndHoldGesture ) ) ) {
   784             if( d->onHandle( event->mapToGraphicsScene(tap->position( ) ) ) ){
   829         if (tapandHold->state() == Qt::GestureStarted) {
       
   830             QPointF relativePos = mapFromScene( event->mapToGraphicsScene(tapandHold->position( ) ) );
       
   831             int pressValue = d->calculateSliderPosition( relativePos );
       
   832             setToolTip(QString::number( pressValue ) );
       
   833             QRectF handleRect=d->handle->boundingRect();
       
   834             QRectF tooltipRect =  handleRect;
       
   835             QRectF touchPointRect=handleRect;
       
   836             if (orientation() == Qt::Horizontal) {
       
   837                 touchPointRect.moveCenter(QPointF( boundingRect().width()/2,boundingRect( ).height()/2 ) );
       
   838                 touchPointRect.moveLeft(relativePos.rx() - touchPointRect.width( )/2);
       
   839 
       
   840             } else {
       
   841                 touchPointRect.moveCenter(QPointF( boundingRect().width()/2,boundingRect( ).height()/2 ) );
       
   842                 touchPointRect.moveTop( relativePos.ry() - touchPointRect.height()/2 );
       
   843             }
       
   844             tooltipRect.setHeight ( d->tooltipBorderHeight);
       
   845             tooltipRect.moveBottom( touchPointRect.top() );
       
   846             tooltipRect.moveLeft (touchPointRect.left( ) );
       
   847             d->tooltipArea->setGeometry(tooltipRect);
       
   848             d->tooltipArea->setGeometry(tooltipRect);
       
   849             d->tooltipArea->update();
       
   850             if ( d->displayCurrValueToolTip ) {
       
   851                 HbToolTip::showText( toolTip( ) , d->tooltipArea, d->toolTipAlignment );
       
   852             }
       
   853 
       
   854             return;
       
   855         }
       
   856     }
       
   857     if ( HbTapGesture *tap = qobject_cast<HbTapGesture *> (event->gesture( Qt::TapGesture ) )) {
       
   858         if ( d->onHandle( event->mapToGraphicsScene(tap->position( ) ) ) ) {
   785                 event->ignore();
   859                 event->ignore();
   786                 return;
   860                 return;
   787             }
   861         }
   788         switch(tap->state()) {
   862         switch( tap->state( ) ) {
   789         case Qt::GestureStarted: {
   863         case Qt::GestureStarted: {
   790             QRectF eventRect = d->grooveTouchArea->sceneBoundingRect( );
   864             QRectF eventRect = d->grooveTouchArea->sceneBoundingRect( );
   791             if ( !d->trackHandlingEnable  || maximum( ) == minimum( ) || 
   865             if ( !d->trackHandlingEnable  || maximum( ) == minimum( ) || 
   792                 !eventRect.contains( event->mapToGraphicsScene(tap->position( ) ) ) ){
   866                 !eventRect.contains( event->mapToGraphicsScene(tap->position( ) ) ) ) {
   793                 event->ignore( );
   867                 event->ignore( );
   794                 return;
   868                 return;
   795             }
   869             }
   796             
   870             
   797 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )
   871 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )
   800             }
   874             }
   801 #endif
   875 #endif
   802             event->accept( );
   876             event->accept( );
   803         // effect
   877         // effect
   804 #ifdef HB_EFFECTS
   878 #ifdef HB_EFFECTS
   805             if( orientation( ) == Qt::Horizontal ) {   
   879             if ( orientation( ) == Qt::Horizontal ) {   
   806             // effect for horizontal track press
   880             // effect for horizontal track press
   807                 HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackpress", "h_trackpress" );
   881                 HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackpress", "h_trackpress" );
   808                 HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrpress" );
   882                 HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrpress" );
   809             }
   883             } else {
   810             else {
       
   811                 HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_v_trackpress", "v_trackpress" );
   884                 HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_v_trackpress", "v_trackpress" );
   812                 HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "v_trackpress" );
   885                 HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "v_trackpress" );
   813             }  
   886             }  
   814     
   887     
   815 #endif
   888 #endif
   816             HbStyleOptionSlider opt;
   889             HbStyleOptionSlider opt;
   817             d->groovePressed = true;
   890             d->groovePressed = true;
   818             initStyleOption( &opt );
   891             initStyleOption( &opt );
   819             style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );  
   892             HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );  
   820             HbWidgetFeedback::triggered( this, Hb::InstantPressed );
   893             HbWidgetFeedback::triggered( this, Hb::InstantPressed );
   821         }
   894         }
   822         break;
   895         break;
   823         case Qt::GestureFinished:{
   896         case Qt::GestureFinished:{
   824             if ( !d->trackHandlingEnable ) {
   897             if ( !d->trackHandlingEnable ) {
   825                 event->ignore( );
   898                 event->ignore( );
   826                 return;
   899                 return;
   827             }
   900             }
   828             qreal handlePos = 0;
       
   829             qreal span = 0;
       
   830             QRectF bounds = boundingRect( );
       
   831             QRectF handleBounds = d->handle->boundingRect( );
       
   832             bounds.adjust( 0, 0, -handleBounds.width( ), -handleBounds.height( ) );
       
   833             QPointF relativePos = mapFromScene( event->mapToGraphicsScene(tap->position( ) ) );
   901             QPointF relativePos = mapFromScene( event->mapToGraphicsScene(tap->position( ) ) );
   834             // calculate handle position and span
   902             int pressValue = d->calculateSliderPosition (relativePos);
   835             switch ( orientation( ) ) {
       
   836                 case Qt::Horizontal:
       
   837                     handlePos = relativePos.x( ) - handleBounds.width( ) / 2;
       
   838                     span = bounds.width( );
       
   839                     break;
       
   840                 case Qt::Vertical:
       
   841                     handlePos = relativePos.y( ) - handleBounds.height( ) / 2;
       
   842                     span = bounds.height( );
       
   843                     break;
       
   844                 default:
       
   845                     break;
       
   846             }
       
   847             HbStyleOptionSlider opt;
       
   848             initStyleOption( &opt );
       
   849 
       
   850             int pressValue = QStyle::sliderValueFromPosition( opt.minimum, opt.maximum,
       
   851                 static_cast<int>( handlePos ),static_cast<int>( span ),opt.upsideDown );
       
   852 
       
   853 
       
   854             // if default is set then don't increment or decrement slider value
   903             // if default is set then don't increment or decrement slider value
   855             // just set default value to slider
   904             // just set default value to slider
   856             setSliderPosition( pressValue );
   905             setSliderPosition( pressValue );
   857             triggerAction( SliderMove );
   906             triggerAction( SliderMove );
   858             setRepeatAction( SliderNoAction, pressValue );
   907             setRepeatAction( SliderNoAction, pressValue );
   859             HbWidgetFeedback::triggered( this, Hb::InstantReleased );
   908             HbWidgetFeedback::triggered( this, Hb::InstantReleased );
   860             if ( d->groovePressed ) {
   909             if ( d->groovePressed ) {
   861 #ifdef HB_EFFECTS    
   910 #ifdef HB_EFFECTS    
   862                 if( orientation( ) == Qt::Horizontal ) {   
   911                 if ( orientation( ) == Qt::Horizontal ) {   
   863                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackrelease", "h_trackrelease" );
   912                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackrelease", "h_trackrelease" );
   864                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrelease" );
   913                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrelease" );
   865                 }  else {
   914                 }  else {
   866                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_v_trackrelease", "v_trackrelease" );
   915                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_v_trackrelease", "v_trackrelease" );
   867                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "v_trackrelease" );
   916                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "v_trackrelease" );
   869 #endif
   918 #endif
   870                 HbStyleOptionSlider opt;
   919                 HbStyleOptionSlider opt;
   871                 d->groovePressed = false;
   920                 d->groovePressed = false;
   872                 initStyleOption( &opt );    
   921                 initStyleOption( &opt );    
   873                 // update primitive from press to normal
   922                 // update primitive from press to normal
   874                 style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );
   923                 HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );
   875             }
   924             }
   876          }
   925          }
   877          break;
   926          break;
   878 
   927 
   879         case Qt::GestureCanceled: {
   928         case Qt::GestureCanceled: {
   880             if ( d->groovePressed ) {
   929             if ( d->groovePressed ) {
   881 #ifdef HB_EFFECTS    
   930 #ifdef HB_EFFECTS    
   882                 if( orientation( ) == Qt::Horizontal ) {   
   931                 if ( orientation( ) == Qt::Horizontal ) {   
   883                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackrelease", "h_trackrelease" );
   932                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_h_trackrelease", "h_trackrelease" );
   884                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrelease" );
   933                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "h_trackrelease" );
   885                 }  else {
   934                 }  else {
   886                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_v_trackrelease", "v_trackrelease" );
   935                     HbEffectInternal::add( HB_SLIDERCONTROL_TYPE,"slider_v_trackrelease", "v_trackrelease" );
   887                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "v_trackrelease" );
   936                     HbEffect::start( d->groove, HB_SLIDERCONTROL_TYPE, "v_trackrelease" );
   889 #endif
   938 #endif
   890                 HbStyleOptionSlider opt;
   939                 HbStyleOptionSlider opt;
   891                 d->groovePressed = false;
   940                 d->groovePressed = false;
   892                 initStyleOption( &opt );    
   941                 initStyleOption( &opt );    
   893                 // update primitive from press to normal
   942                 // update primitive from press to normal
   894                 style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );
   943                 HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );
   895             }
   944             }
   896         }
   945         }
   897         break;
   946         break;
   898 
   947 
   899         default:
   948         default:
   900             break;
   949             break;
   901         }
   950         }
   902     }
   951     }
   903     if (HbPanGesture *panGesture = qobject_cast<HbPanGesture*>(event->gesture(Qt::PanGesture))) {
   952     if ( HbPanGesture *panGesture = qobject_cast<HbPanGesture*> (event->gesture(Qt::PanGesture) ) ) {
   904         switch(panGesture->state( )) {
   953         switch(panGesture->state( ) ) {
   905             case Qt::GestureStarted: 
   954             case Qt::GestureStarted: 
   906             case Qt::GestureUpdated:{
   955             case Qt::GestureUpdated:{
   907                 QPointF startPoint = event->mapToGraphicsScene(panGesture->offset()+panGesture->startPos( ) );
   956                 QPointF startPoint = event->mapToGraphicsScene(panGesture->offset()+panGesture->startPos( ) );
   908 				//if the position is on thumb , then start moving the thumb
   957                 //if the position is on thumb , then start moving the thumb
   909                 if( ( d->onHandle( startPoint) && d->grooveTouchArea->sceneBoundingRect( ).contains( startPoint))||isSliderDown( ) ) {
   958                 if ( ( d->onHandle( startPoint) && d->grooveTouchArea->sceneBoundingRect( ).contains( startPoint) )||isSliderDown( ) ) {
   910                     qreal handlePos = 0;
   959                     QPointF relativePos = mapFromScene( event->mapToGraphicsScene(panGesture->startPos( ) + panGesture->offset() ) );
   911                     qreal span = 0;
   960                     int pressValue = d->calculateSliderPosition (relativePos);
   912                     QRectF bounds = boundingRect( );
       
   913                     QRectF handleBounds = d->handle->boundingRect( );
       
   914                     bounds.adjust( 0, 0, -handleBounds.width( ), -handleBounds.height( ) );
       
   915                     QPointF relativePos = mapFromScene( event->mapToGraphicsScene(panGesture->startPos( ) + panGesture->offset()) );
       
   916                     // calculate handle position and span
       
   917                     switch ( orientation( ) ) {
       
   918                         case Qt::Horizontal:
       
   919                             handlePos = relativePos.x( ) - handleBounds.width( ) / 2;
       
   920                             span = bounds.width( );
       
   921                             break;
       
   922                         case Qt::Vertical:
       
   923                             handlePos = relativePos.y( ) - handleBounds.height( ) / 2;
       
   924                             span = bounds.height( );
       
   925                             break;
       
   926                         default:
       
   927                             break;
       
   928                     }
       
   929                     HbStyleOptionSlider opt;
       
   930                     initStyleOption( &opt );
       
   931 
       
   932                     int pressValue = QStyle::sliderValueFromPosition( opt.minimum, opt.maximum,
       
   933                         static_cast<int>( handlePos ),static_cast<int>( span ),opt.upsideDown ); 
       
   934                     setRepeatAction( SliderNoAction,static_cast<int>( pressValue ) );
   961                     setRepeatAction( SliderNoAction,static_cast<int>( pressValue ) );
   935                     setSliderDown( true );
   962                     setSliderDown( true );
   936                     setSliderPosition( pressValue );
   963                     setSliderPosition( pressValue );
       
   964                     setToolTip( QString::number( pressValue ) );
   937                     showToolTip( );
   965                     showToolTip( );
   938                     d->groovePressed = false;
   966                     d->groovePressed = false;
   939                     updatePrimitives();
   967                     updatePrimitives();
   940                     d->handleMoving = true ;
   968                     d->handleMoving = true ;
   941                     break;
   969                     break;
   942                 } else if(d->grooveTouchArea->sceneBoundingRect().contains(startPoint) ){
   970                 } else if (d->grooveTouchArea->sceneBoundingRect().contains(startPoint) ) {
       
   971                     QPointF relativePos = mapFromScene( event->mapToGraphicsScene(panGesture->startPos( ) + panGesture->offset() ) );
       
   972                     int pressValue = d->calculateSliderPosition (relativePos);
       
   973                     setToolTip( QString::number( pressValue ) );
       
   974                     QRectF handleRect=d->handle->boundingRect();
       
   975                     QRectF tooltipRect =  handleRect;
       
   976                     QRectF touchPointRect=handleRect;
       
   977                     if (orientation() == Qt::Horizontal) {
       
   978                         touchPointRect.moveCenter(QPointF( boundingRect().width()/2,boundingRect( ).height()/2 ) );
       
   979                         touchPointRect.moveLeft(relativePos.rx() - touchPointRect.width( )/2);
       
   980                     } else {
       
   981                         touchPointRect.moveCenter(QPointF( boundingRect().width()/2,boundingRect( ).height()/2 ) );
       
   982                         touchPointRect.moveTop( relativePos.ry() - touchPointRect.height()/2 );
       
   983                     }
       
   984                     tooltipRect.setHeight ( d->tooltipBorderHeight);
       
   985                     tooltipRect.moveBottom( touchPointRect.top() );
       
   986                     tooltipRect.moveLeft (touchPointRect.left( ) );
       
   987                     d->tooltipArea->setGeometry(tooltipRect);
       
   988                     d->tooltipArea->setGeometry(tooltipRect);
       
   989                     d->tooltipArea->update();
       
   990                     if ( d->displayCurrValueToolTip ) {
       
   991                         HbToolTip::showText( toolTip( ) , d->tooltipArea, d->toolTipAlignment );
       
   992                     }
       
   993                     d->groovePressed = true;
   943                     HbStyleOptionSlider opt;
   994                     HbStyleOptionSlider opt;
   944                     d->groovePressed = true;
       
   945                     initStyleOption( &opt );
   995                     initStyleOption( &opt );
   946                     style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );  
   996                     HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );  
   947                     HbWidgetFeedback::triggered( this, Hb::InstantPressed );
       
   948                     event->ignore();
   997                     event->ignore();
       
   998                     QPointF diffOffset = panGesture->offset() - panGesture->lastOffset();
       
   999                     if (orientation() == Qt::Horizontal) {
       
  1000                         if (qAbs(diffOffset.x() ) < qAbs(diffOffset.y())) {
       
  1001                             HbAbstractSliderControl::gestureEvent(event);
       
  1002 
       
  1003                         }
       
  1004                     } else {
       
  1005                         if (qAbs(diffOffset.y() ) < qAbs(diffOffset.x())) {
       
  1006                             HbAbstractSliderControl::gestureEvent(event);
       
  1007                         }
       
  1008                     }
       
  1009 
   949                     break;
  1010                     break;
   950                 } else {
  1011                 } else {
   951                     setSliderDown( false );
  1012                     setSliderDown( false );
   952                     d->groovePressed = false;
  1013                     d->groovePressed = false;
   953                     updatePrimitives( );
  1014                     updatePrimitives( );
   959 
  1020 
   960             }
  1021             }
   961             break;
  1022             break;
   962             case Qt::GestureFinished:
  1023             case Qt::GestureFinished:
   963             case Qt::GestureCanceled: {
  1024             case Qt::GestureCanceled: {
       
  1025                 QPointF startPoint = event->mapToGraphicsScene(panGesture->offset()+panGesture->startPos( ) );
   964                 setSliderDown( false );
  1026                 setSliderDown( false );
   965                 d->groovePressed = false;
  1027                 d->groovePressed = false;
   966                 updatePrimitives( );
  1028                 updatePrimitives( );
   967                 d->handle->updatePrimitives();
  1029                 d->handle->updatePrimitives();
   968                 d->handleMoving = false;
  1030                 if( d->handleMoving ) {
   969 				int pressValue = sliderPosition();
  1031                     HbWidgetFeedback::triggered(this, Hb::InstantReleased, Hb::ModifierSliderHandle);
   970                 setRepeatAction( SliderNoAction,static_cast<int>( pressValue ) );
  1032                     d->handleMoving = false;
       
  1033                 }
       
  1034                 if (d->grooveTouchArea->sceneBoundingRect().contains(startPoint) ) {
       
  1035                     QPointF relativePos = mapFromScene( event->mapToGraphicsScene(panGesture->startPos( ) + panGesture->offset() ) );
       
  1036                     int pressValue = d->calculateSliderPosition (relativePos);
       
  1037                     setRepeatAction( SliderNoAction,static_cast<int>( pressValue ) );
       
  1038                     setSliderPosition( pressValue );
       
  1039                     setToolTip( QString::number( pressValue ) );
       
  1040                     showToolTip( );
       
  1041                     HbWidgetFeedback::triggered( this, Hb::InstantReleased );
       
  1042                 }
   971                 event->ignore();
  1043                 event->ignore();
   972                 HbAbstractSliderControl::gestureEvent(event);
  1044                 HbAbstractSliderControl::gestureEvent(event);
   973             }
  1045             }
   974             break;
  1046             break;
   975             default:
  1047             default:
   986     Q_D(HbSliderControl);
  1058     Q_D(HbSliderControl);
   987     if( obj == d->grooveTouchArea  ) {
  1059     if( obj == d->grooveTouchArea  ) {
   988         if (!isEnabled() ) {
  1060         if (!isEnabled() ) {
   989             return false;
  1061             return false;
   990         }
  1062         }
   991 	    if (event->type() == QEvent::Gesture){
  1063         if (event->type() == QEvent::Gesture){
   992             gestureEvent( (QGestureEvent *) (event));
  1064             gestureEvent( (QGestureEvent *) (event));
   993             return true;
  1065             return true;
   994         }
  1066         }
   995     }
  1067     }
   996     else if ( obj == d->handle) {
  1068     else if ( obj == d->handle) {
   997         event->ignore();
  1069         event->ignore();
   998 	    if (event->type() == QEvent::Gesture){
  1070         if (event->type() == QEvent::Gesture){
   999             QGestureEvent *gestureEvent = static_cast<QGestureEvent *> (event);
  1071             QGestureEvent *gestureEvent = static_cast<QGestureEvent *> (event);
  1000             foreach(QGesture *g, gestureEvent->gestures()) {
  1072             foreach(QGesture *g, gestureEvent->gestures()) {
  1001                 gestureEvent->ignore(g);
  1073                 gestureEvent->ignore(g);
  1002             }
  1074             }
  1003         }
  1075         }
  1004     }
  1076     }
  1005 	return false;
  1077     return false;
  1006 }
  1078 }
  1007 
  1079 
  1008 
  1080 
  1009 /*!
  1081 /*!
  1010   
  1082   
  1021 */
  1093 */
  1022 void HbSliderControl::resizeEvent( QGraphicsSceneResizeEvent *event )
  1094 void HbSliderControl::resizeEvent( QGraphicsSceneResizeEvent *event )
  1023 {
  1095 {
  1024     Q_D( HbSliderControl );
  1096     Q_D( HbSliderControl );
  1025     QGraphicsWidget::resizeEvent( event );
  1097     QGraphicsWidget::resizeEvent( event );
  1026     // for Bug Fix::Ticks are not getting updated after 
       
  1027     // element is added to slider
       
  1028     updatePrimitives( );
  1098     updatePrimitives( );
  1029     repolish();
       
  1030     d->adjustHandle( );  
  1099     d->adjustHandle( );  
  1031 }
  1100 }
  1032 /*!
  1101 /*!
  1033   reimp
  1102   reimp
  1034 
  1103 
  1035 */
  1104 */
  1036 void HbSliderControl::polish( HbStyleParameters& params )
  1105 void HbSliderControl::polish( HbStyleParameters& params )
  1037 {
  1106 {
  1038     Q_D( HbSliderControl );
  1107     Q_D( HbSliderControl );
       
  1108     params.addParameter("tooltip-border-height");
  1039     HbStyleOptionSlider option;
  1109     HbStyleOptionSlider option;
  1040     initStyleOption( &option );
  1110     initStyleOption( &option );
  1041     HbAbstractSliderControl::polish( params );
  1111     HbAbstractSliderControl::polish( params );
  1042     d->adjustHandle( );
  1112     d->adjustHandle( );
  1043     updatePrimitives( );
  1113     updatePrimitives( );
       
  1114     d->tooltipBorderHeight = params.value("tooltip-border-height").toReal();
       
  1115 
  1044 }
  1116 }
  1045 
  1117 
  1046 /*!
  1118 /*!
  1047  
  1119  
  1048 */
  1120 */
  1128 }
  1200 }
  1129 
  1201 
  1130 QGraphicsItem* HbSliderControl::handleItem( ) const
  1202 QGraphicsItem* HbSliderControl::handleItem( ) const
  1131 {
  1203 {
  1132     Q_D( const HbSliderControl );
  1204     Q_D( const HbSliderControl );
  1133 	if(d->handle) {
  1205     if(d->handle) {
  1134 		return d->handle->handleItem();
  1206         return d->handle->handleItem();
  1135 	}
  1207     }
  1136 	return NULL;
  1208     return NULL;
  1137 }
  1209 }
  1138 
  1210 
  1139 void HbSliderControl::setHandleVisible(bool isVisible)
  1211 void HbSliderControl::setHandleVisible(bool isVisible)
  1140 {
  1212 {
  1141     Q_D( HbSliderControl );
  1213     Q_D( HbSliderControl );
  1142 	if(isVisible) {
  1214     if(isVisible) {
  1143 		d->handle->setVisible(true);
  1215         d->handle->setVisible(true);
  1144 	} else {
  1216     } else {
  1145 		d->handle->setVisible(false);
  1217         d->handle->setVisible(false);
  1146 	}
  1218     }
  1147 }
  1219 }
  1148 
  1220 
  1149 bool HbSliderControl::handleVisible( ) const
  1221 bool HbSliderControl::handleVisible( ) const
  1150 {
  1222 {
  1151     Q_D( const HbSliderControl );
  1223     Q_D( const HbSliderControl );
  1152 	return d->handle->isVisible();
  1224     return d->handle->isVisible();
  1153 }
  1225 }
  1154  
  1226  
  1155 /*!
  1227 /*!
  1156   adjust the handle
  1228   adjust the handle
  1157 */
  1229 */
  1159 {
  1231 {
  1160     Q_D( HbSliderControl );
  1232     Q_D( HbSliderControl );
  1161     HbAbstractSliderControl::sliderChange( change );
  1233     HbAbstractSliderControl::sliderChange( change );
  1162     d->adjustHandle( );
  1234     d->adjustHandle( );
  1163     if ( change == SliderOrientationChange ) {
  1235     if ( change == SliderOrientationChange ) {
  1164         //Layout is not mirrored in vertical orientation with absolute ticks
       
  1165         if(d->orientation ==Qt::Horizontal) { 
       
  1166             if (!d->userDefinedTooltipAlign) {
       
  1167                 d->toolTipAlignment = ( Qt::AlignTop|Qt::AlignHCenter );
       
  1168             }
       
  1169         } else {
       
  1170             if (!d->userDefinedTooltipAlign) {
       
  1171                 // Bug in tooltip, cannot align it with top right
       
  1172                 d->toolTipAlignment = ( Qt::AlignTop|Qt::AlignHCenter );
       
  1173             }
       
  1174         }
       
  1175         repolish( );
  1236         repolish( );
  1176     }
  1237     }
  1177 }
  1238 }
  1178 
  1239 
  1179 
  1240 
  1182 */
  1243 */
  1183 QGraphicsItem * HbSliderControl::primitive( HbStyle::Primitive primitive ) const
  1244 QGraphicsItem * HbSliderControl::primitive( HbStyle::Primitive primitive ) const
  1184 {
  1245 {
  1185     Q_D( const HbSliderControl );
  1246     Q_D( const HbSliderControl );
  1186     switch( primitive ){
  1247     switch( primitive ){
  1187         case HbStyle::P_Slider_groove:
  1248         case HbStylePrivate::P_Slider_groove:
  1188             return ( d->groove );
  1249             return ( d->groove );
  1189         case HbStyle::P_Slider_thumb:
  1250         case HbStylePrivate::P_Slider_thumb:
  1190             return ( d->handle );
  1251             return ( d->handle );
  1191         case HbStyle::P_Slider_progressgroove:
  1252         case HbStylePrivate::P_Slider_progressgroove:
  1192             return ( d->progressGroove );
  1253             return ( d->progressGroove );
  1193         default:return( NULL );
  1254         default:return( NULL );
  1194     }
  1255     }
  1195 }
  1256 }
  1196 
  1257 
  1212                 updatePrimitives( );
  1273                 updatePrimitives( );
  1213                 if ( d->handle ) {
  1274                 if ( d->handle ) {
  1214                     d->handle->updatePrimitives( );
  1275                     d->handle->updatePrimitives( );
  1215                 }
  1276                 }
  1216                 d->groovePressed = false;
  1277                 d->groovePressed = false;
  1217             } else {
       
  1218                 repolish();
       
  1219             }
  1278             }
  1220         break;
  1279         break;
  1221         case ItemSceneHasChanged: {
  1280         case ItemSceneHasChanged: {
  1222             updatePrimitives();
  1281             updatePrimitives();
  1223         }
  1282         }
  1255         opt.state |= QStyle::State_Enabled;
  1314         opt.state |= QStyle::State_Enabled;
  1256     } else {
  1315     } else {
  1257         opt.state &= ~QStyle::State_Enabled;
  1316         opt.state &= ~QStyle::State_Enabled;
  1258     }
  1317     }
  1259     if ( d->groove ) {
  1318     if ( d->groove ) {
  1260         style( )->updatePrimitive( d->groove, HbStyle::P_Slider_groove, &opt );
  1319         HbStylePrivate::updatePrimitive( d->groove, HbStylePrivate::P_Slider_groove, &opt );
  1261     }
  1320     }
  1262 
  1321 
  1263     if( d->progressGroove ) {
  1322     if( d->progressGroove ) {
  1264             style( )->updatePrimitive( d->progressGroove, HbStyle::P_Slider_progressgroove, &opt );
  1323             HbStylePrivate::updatePrimitive( d->progressGroove, HbStylePrivate::P_Slider_progressgroove, &opt );
  1265     }
  1324     }
  1266 
  1325 
  1267 }
  1326 }
  1268 
  1327 
  1269 /*!
  1328 /*!
  1320     if ( d->trackHandlingEnable == enable ) {
  1379     if ( d->trackHandlingEnable == enable ) {
  1321         return;
  1380         return;
  1322     }
  1381     }
  1323     if ( enable ) {
  1382     if ( enable ) {
  1324         //creating groove touch area
  1383         //creating groove touch area
  1325         d->grooveTouchArea =  qgraphicsitem_cast<QGraphicsItem*>( style( )->createPrimitive(
  1384         d->grooveTouchArea =  qgraphicsitem_cast<QGraphicsItem*>( HbStylePrivate::createPrimitive(
  1326             HbStyle::P_SliderElement_touchgroove, this ) );
  1385             HbStylePrivate::P_SliderElement_touchgroove, this ) );
  1327         if ( d->grooveTouchArea ) {
  1386         if ( d->grooveTouchArea ) {
  1328             HbStyle::setItemName( d->grooveTouchArea, "groovetoucharea" );
  1387             HbStyle::setItemName( d->grooveTouchArea, "groovetoucharea" );
  1329         }
  1388         }
  1330         if(QGraphicsObject *touchArea = d->grooveTouchArea->toGraphicsObject()) {
  1389         if(QGraphicsObject *touchArea = d->grooveTouchArea->toGraphicsObject()) {
  1331 
  1390 
  1332 #ifdef HB_GESTURE_FW
  1391 #ifdef HB_GESTURE_FW
  1333             ungrabGesture(Qt::TapGesture);
  1392             ungrabGesture(Qt::TapGesture);
  1334             ungrabGesture(Qt::PanGesture);
  1393             ungrabGesture(Qt::PanGesture);
       
  1394             ungrabGesture(Qt::TapAndHoldGesture);
  1335             touchArea->grabGesture(Qt::TapGesture);
  1395             touchArea->grabGesture(Qt::TapGesture);
       
  1396             touchArea->grabGesture(Qt::TapAndHoldGesture);
  1336             touchArea->grabGesture(Qt::PanGesture);
  1397             touchArea->grabGesture(Qt::PanGesture);
  1337 #endif 
  1398 #endif 
  1338         }
  1399         }
  1339     }
  1400     }
  1340     d->trackHandlingEnable = enable ;
  1401     d->trackHandlingEnable = enable ;