src/hbwidgets/sliders/hbratingslider.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
    20 **
    20 **
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 #include "hbratingslider_p.h"
    26 #include <hbratingslider.h>
    26 #include <hbratingslider.h>
    27 #include "hbratingslider_p.h"
       
    28 #include <hbtooltip.h>
    27 #include <hbtooltip.h>
    29 #include <hbstyleoptionratingslider_p.h>
    28 #include <hbstyleoptionratingslider_p.h>
    30 #include <QGraphicsItem>
    29 #include <QGraphicsItem>
    31 #include <QGraphicsSceneMouseEvent>
    30 #include <QGraphicsSceneMouseEvent>
    32 #include <hbtoucharea.h>
    31 #include <hbtoucharea.h>
       
    32 #include <hbwidgetfeedback.h>
    33 
    33 
    34 #ifdef HB_GESTURE_FW
    34 #ifdef HB_GESTURE_FW
    35 #include <hbtapgesture.h>
    35 #include <hbtapgesture.h>
    36 #include <hbpangesture.h>
    36 #include <hbpangesture.h>
    37 #endif 
    37 #endif 
   564                     event->ignore();
   564                     event->ignore();
   565                     return;
   565                     return;
   566                 }
   566                 }
   567                 QRectF rect = d->mTouchArea->boundingRect();
   567                 QRectF rect = d->mTouchArea->boundingRect();
   568                 if(rect.contains(xVal,0 )) {
   568                 if(rect.contains(xVal,0 )) {
       
   569                     HbWidgetFeedback::triggered(this, Hb::InstantPressed);
   569                     d->mMousePressed = true;
   570                     d->mMousePressed = true;
   570                     updatePrimitives();
   571                     updatePrimitives();
   571                     rating = d->calculateProgressValue(xVal);
   572                     rating = d->calculateProgressValue(xVal);
   572                     setCurrentRating(rating);
   573                     setCurrentRating(rating);
   573                     event->accept();
   574                     event->accept();
   604         
   605         
   605                if(!toolTip().isNull()) {
   606                if(!toolTip().isNull()) {
   606                     HbToolTip::showText(toolTip(),this);
   607                     HbToolTip::showText(toolTip(),this);
   607                 }    
   608                 }    
   608                 setCurrentRating(rating);
   609                 setCurrentRating(rating);
       
   610                 HbWidgetFeedback::triggered(this, Hb::InstantReleased);
   609                 if(d->mCurrentValue) {
   611                 if(d->mCurrentValue) {
   610                     emit ratingDone (d->mCurrentValue);
   612                     emit ratingDone (d->mCurrentValue);
   611                 }
   613                 }
       
   614 
   612                 event->accept();
   615                 event->accept();
   613                 d->mMousePressed = false;
   616                 d->mMousePressed = false;
   614                 updatePrimitives();
   617                 updatePrimitives();
   615             }            
   618             }            
   616             else {
   619             else {
   659                                 
   662                                 
   660                                 if(!toolTip().isNull()) {
   663                                 if(!toolTip().isNull()) {
   661                                     HbToolTip::showText(toolTip(),this);
   664                                     HbToolTip::showText(toolTip(),this);
   662                                 }    
   665                                 }    
   663                                 setCurrentRating(rating);
   666                                 setCurrentRating(rating);
       
   667                                 HbWidgetFeedback::continuousTriggered(this, Hb::ContinuousDragged);
   664                                 emit ratingChanged (d->mCurrentValue);
   668                                 emit ratingChanged (d->mCurrentValue);
   665                                 event->accept();
   669                                 event->accept();
   666                             }
   670                             }
   667                             else {
   671                             else {
   668                                 setCurrentRating(0);
   672                                 setCurrentRating(0);
   689                             return;
   693                             return;
   690                           }
   694                           }
   691 
   695 
   692                           rating = d->calculateProgressValue(xVal);
   696                           rating = d->calculateProgressValue(xVal);
   693                           setCurrentRating(rating);
   697                           setCurrentRating(rating);
       
   698                           HbWidgetFeedback::triggered(this, Hb::InstantReleased);
   694                           if(d->mCurrentValue) {
   699                           if(d->mCurrentValue) {
   695                              emit ratingDone (d->mCurrentValue);
   700                              emit ratingDone (d->mCurrentValue);
   696                            }                       
   701                            }                       
   697                            event->accept();
   702                            event->accept();
   698                         
   703