src/hbwidgets/sliders/hbslidercontrol.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
    98    
    98    
    99     // creating handle
    99     // creating handle
   100     handle = createHandle();
   100     handle = createHandle();
   101     if(handle) {
   101     if(handle) {
   102         HbStyle::setItemName( handle, "handle" );
   102         HbStyle::setItemName( handle, "handle" );
   103     } 
   103     }
       
   104 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )    
   104     q->setFocusPolicy( Qt::FocusPolicy( ( qApp->style( ) )->styleHint( QStyle::SH_Button_FocusPolicy ) ) );
   105     q->setFocusPolicy( Qt::FocusPolicy( ( qApp->style( ) )->styleHint( QStyle::SH_Button_FocusPolicy ) ) );
       
   106 #endif
   105     groove = createGroove();
   107     groove = createGroove();
   106     if(groove) {
   108     if(groove) {
   107         HbStyle::setItemName( groove, "groove" );
   109         HbStyle::setItemName( groove, "groove" );
   108     }
   110     }
   109 #ifdef HB_GESTURE_FW
   111 #ifdef HB_GESTURE_FW
   118         }    
   120         }    
   119     }
   121     }
   120     q->connect( hbInstance->theme( ), SIGNAL( changed( ) ), q, SLOT( updateTheme( ) ) );
   122     q->connect( hbInstance->theme( ), SIGNAL( changed( ) ), q, SLOT( updateTheme( ) ) );
   121     q->connect( q , SIGNAL( actionTriggered( int ) ), q , SLOT( showToolTip( ) ) );
   123     q->connect( q , SIGNAL( actionTriggered( int ) ), q , SLOT( showToolTip( ) ) );
   122     q->connect( q , SIGNAL( sliderReleased( ) ), q , SLOT( hideToolTip( ) ) );
   124     q->connect( q , SIGNAL( sliderReleased( ) ), q , SLOT( hideToolTip( ) ) );
       
   125 #if defined( QT_KEYPAD_NAVIGATION ) && !defined( Q_OS_SYMBIAN )
   123     q->setFlags( QGraphicsItem::ItemIsFocusable );
   126     q->setFlags( QGraphicsItem::ItemIsFocusable );
       
   127 #endif
   124 }
   128 }
   125 
   129 
   126 
   130 
   127 
   131 
   128 /*!
   132 /*!
   591 */
   595 */
   592 void HbSliderControl::showToolTip( )
   596 void HbSliderControl::showToolTip( )
   593 {
   597 {
   594     Q_D( HbSliderControl );
   598     Q_D( HbSliderControl );
   595     if ( isSliderDown( ) && d->displayCurrValueToolTip ) {
   599     if ( isSliderDown( ) && d->displayCurrValueToolTip ) {
   596         HbToolTip::showText( toolTip( ) , d->handle , d->toolTipAlignment );
   600         HbToolTip::showText( toolTip( ) , d->handle->primitive(HbStyle::P_SliderElement_touchhandle) , d->toolTipAlignment );
   597     }
   601     }
   598 }
   602 }
   599 
   603 
   600 /*!
   604 /*!
   601   reimp
   605   reimp
   971             default:
   975             default:
   972                 break;
   976                 break;
   973         }
   977         }
   974     }
   978     }
   975 
   979 
   976   //  HbAbstractSliderControl::gestureEvent(event);
       
   977 }
   980 }
   978 #endif
   981 #endif
   979 
   982 
   980 
   983 
   981 bool HbSliderControl::sceneEventFilter(QGraphicsItem *obj,QEvent *event)
   984 bool HbSliderControl::sceneEventFilter(QGraphicsItem *obj,QEvent *event)
   982 {
   985 {
   983     Q_D(HbSliderControl);
   986     Q_D(HbSliderControl);
   984     if( obj == d->grooveTouchArea) {
   987     if( obj == d->grooveTouchArea  ) {
   985         if (!isEnabled() ) {
   988         if (!isEnabled() ) {
   986             return false;
   989             return false;
   987         }
   990         }
   988 	    if (event->type() == QEvent::Gesture){
   991 	    if (event->type() == QEvent::Gesture){
   989             gestureEvent( (QGestureEvent *) (event));
   992             gestureEvent( (QGestureEvent *) (event));
   990             return true;
   993             return true;
   991         }
   994         }
   992     }
   995     }
   993     else if ( obj == d->handle) {
   996     else if ( obj == d->handle) {
   994         event->ignore();
   997         event->ignore();
       
   998 	    if (event->type() == QEvent::Gesture){
       
   999             QGestureEvent *gestureEvent = static_cast<QGestureEvent *> (event);
       
  1000             foreach(QGesture *g, gestureEvent->gestures()) {
       
  1001                 gestureEvent->ignore(g);
       
  1002             }
       
  1003         }
   995     }
  1004     }
   996 	return false;
  1005 	return false;
   997 }
  1006 }
   998 
  1007 
   999 
  1008 
  1157             if (!d->userDefinedTooltipAlign) {
  1166             if (!d->userDefinedTooltipAlign) {
  1158                 d->toolTipAlignment = ( Qt::AlignTop|Qt::AlignHCenter );
  1167                 d->toolTipAlignment = ( Qt::AlignTop|Qt::AlignHCenter );
  1159             }
  1168             }
  1160         } else {
  1169         } else {
  1161             if (!d->userDefinedTooltipAlign) {
  1170             if (!d->userDefinedTooltipAlign) {
  1162                 d->toolTipAlignment = ( Qt::AlignTop|Qt::AlignRight );
  1171                 // Bug in tooltip, cannot align it with top right
       
  1172                 d->toolTipAlignment = ( Qt::AlignTop|Qt::AlignHCenter );
  1163             }
  1173             }
  1164         }
  1174         }
  1165         repolish( );
  1175         repolish( );
  1166     }
  1176     }
  1167 }
  1177 }
  1336 bool HbSliderControl::isTrackEventHandlingEnabled ( )
  1346 bool HbSliderControl::isTrackEventHandlingEnabled ( )
  1337 {
  1347 {
  1338     Q_D( HbSliderControl );
  1348     Q_D( HbSliderControl );
  1339     return d->trackHandlingEnable ;
  1349     return d->trackHandlingEnable ;
  1340 }
  1350 }
  1341 
       
  1342 /*!
  1351 /*!
  1343  Gets the size of the handle
  1352  Gets the size of the handle
  1344  */
  1353  */
  1345 
  1354 
  1346 QSizeF HbSliderControl::getHandleSize ( ) 
  1355 QSizeF HbSliderControl::getHandleSize ( )