src/hbwidgets/sliders/hbratingslider.cpp
changeset 5 627c4a0fd0e7
parent 3 11d3954df52a
child 6 c3690ec91ef8
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
   138     
   138     
   139 }
   139 }
   140 
   140 
   141 /*!
   141 /*!
   142     \class HbRatingSlider
   142     \class HbRatingSlider
   143     \brief This is a widget through which user can do rating for videos , music etc.
   143     \brief This is a widget that enables a user to rate contents like videos , music etc.
   144     \image html ratingslider.png  "A Rating Slider with rating done"
   144     \image html ratingslider.png  "A Rating Slider with rating done"
   145 
   145 
   146     By default there are 5 ratings. The default rating graphics comes from theme.It supports custom graphics 
   146     The default version of Rating Slider contains 5 repeated icons drawn side by side, using a single themed graphics.
   147     also.The custom graphics should contain only 1 star.Using the API \a setNumberOfIcons() number of icons can be 
   147     The application can replace the themed graphic with a custom graphic.
   148     configured.By default it is 5 and maximum number of icons is 10.
   148     The custom graphics should contain only one icon (eg one star)  which will be multipled by the API \a setNumberOfIcons().
   149 
   149     By default it is 5 and maximum number of icons are 10.
   150     Along with the rating HbRatingSlider can be used to show the cumulative rating also.
   150 
       
   151     Along with the rating Rating Slider can be used to show the cumulative rating also.
   151 
   152 
   152     To use HbRatingSlider with default settings it just needs to be created.
   153     To use HbRatingSlider with default settings it just needs to be created.
   153     example code:
   154     example code:
   154     \code
   155     \code
   155     HbRatingSlider *object = new HbRatingSlider(parent);
   156     HbRatingSlider *object = new HbRatingSlider(parent);
   158     HbRatingSlider emits below signals 
   159     HbRatingSlider emits below signals 
   159 
   160 
   160     void ratingDone(int ratingValue);
   161     void ratingDone(int ratingValue);
   161     void ratingChanged(int ratingValue);
   162     void ratingChanged(int ratingValue);
   162     
   163     
   163     ratingDone is emits when the user does the rating and releases the finger. 
   164     ratingDone is emitted when the user does the rating and releases the finger. 
   164     ratingChanged is emits when the user changes the rating by simply moving on the Rating Slider
   165     ratingChanged is emitted when the user presses and drags the finger on Rating Slider.
       
   166 
       
   167     To use HbRatingSlider with default settings it just needs to be created. 
       
   168     example code: 
       
   169     \code 
       
   170     HbMainWindow window;
       
   171     HbRatingSlider *rs = new HbRatingSlider();
       
   172     window.addView(rs);
       
   173     \endcode 
   165 
   174 
   166     HbRatingSlider supports integer ratings.But using the API \a setStepCount() fraction ratings can also be 
   175     HbRatingSlider supports integer ratings.But using the API \a setStepCount() fraction ratings can also be 
   167     shown on Rating Slider
   176     shown on Rating Slider
   168 
   177 
   169     The below  code can be used to show some rating e.g. 2.5/5       
   178     The below  code can be used to show some rating e.g. 2.5/5       
   173     slider->setStepCount(50); //5 *10//
   182     slider->setStepCount(50); //5 *10//
   174     slider->setCurrentRating(25); //2.5*10 it shows 25/50 which is same as 2.5/5
   183     slider->setCurrentRating(25); //2.5*10 it shows 25/50 which is same as 2.5/5
   175     \endcode
   184     \endcode
   176     
   185     
   177     This will show as 2.5/5. Now if on the same ratingslider 
   186     This will show as 2.5/5. Now if on the same ratingslider 
   178     the Application wants to configure a rating slider with range 1-5
   187     the Application wants to configure a Rating Slider with range 1-5
   179     on emitting the signal rating changed it can set to 5.
   188     on emitting the signal rating changed it can set to 5.
   180  */
   189  */
   181 
   190 
   182 
   191 
   183 /*!
   192 /*!
   184     @beta
   193     @beta
   185      Constructs a Rating Slider bar with the given parent.
   194      Constructs a Rating Slider bar with the given parent.
   186     \param parent Parent Item.
   195     \param parent Parent Item.
   187 
   196 
   188 */
   197 */
       
   198 
       
   199 
       
   200 
   189 
   201 
   190 HbRatingSlider::HbRatingSlider(QGraphicsItem *parent) :
   202 HbRatingSlider::HbRatingSlider(QGraphicsItem *parent) :
   191 HbWidget(*new HbRatingSliderPrivate,parent)
   203 HbWidget(*new HbRatingSliderPrivate,parent)
   192 {
   204 {
   193     Q_D( HbRatingSlider );
   205     Q_D( HbRatingSlider );
   233 
   245 
   234 /*!    
   246 /*!    
   235     
   247     
   236     @beta  
   248     @beta  
   237     Sets the number of icons. There can be n number of repeated icons. This method can be used to set 
   249     Sets the number of icons. There can be n number of repeated icons. This method can be used to set 
   238     the number of icons required.The default image is "*" and have 5 stars.
   250     the number of icons required.The default image is "*" and has 5 stars.
   239 
   251 
   240     \param number. A value between 1 and 10 
   252     \param number. A value between 1 and 10 
   241 
   253 
   242     \sa numberOfIcons()
   254     \sa numberOfIcons()
   243 */
   255 */
   267     return d->mNumberOfIcons;
   279     return d->mNumberOfIcons;
   268 }
   280 }
   269 
   281 
   270 /*!
   282 /*!
   271     @beta
   283     @beta
   272     Sets the step count for the rating slider.This indicates the interval of the rating. Eg. If step count is 10
   284     Sets the step count for the Rating Slider.This indicates the interval of the rating. Eg. If step count is 10
   273     then 10 rating is possible.
   285     then 10 rating is possible.
   274     
   286     
   275     \param count. A value between 1 and 100. This can be considerd as the maximum rating possible. 
   287     \param count. A value between 1 and 100. This can be considerd as the maximum rating possible. 
   276 
   288 
   277     \sa numberOfIcons()
   289     \sa numberOfIcons()
   352 }
   364 }
   353 
   365 
   354 /*!
   366 /*!
   355     @beta
   367     @beta
   356     
   368     
   357     It sets the unrated graphics name.This is the graphics shown when rating slider is displayed.
   369     It sets the unrated graphics name.This is the graphics shown when Rating Slider is displayed.
   358     the grpahics can be a single star kind of or multi star image. If it is single star then use setNumberOfIcons for 
   370     the graphicscan be a single star kind of or multi star image. If it is single star then use setNumberOfIcons for 
   359     setting number of stars.
   371     setting number of stars.
   360     
   372     
   361     \param name. The graphics name along with the path. 
   373     \param name. The graphics name along with the path. 
   362     \sa unRatedIconName()
   374     \sa unRatedIconName()
   363 */
   375 */
   387 
   399 
   388 /*!
   400 /*!
   389     @beta
   401     @beta
   390     
   402     
   391     It sets the rated graphics name.This is the graphics shown when rating is on going.
   403     It sets the rated graphics name.This is the graphics shown when rating is on going.
   392     the grpahics can be a single star kind of or multi star image. If it is single star then use setNumberOfIcons for 
   404     the graphicscan be a single star kind of or multi star image. If it is single star then use setNumberOfIcons for 
   393     setting number of stars.
   405     setting number of stars.
   394     
   406     
   395     \param name. The graphics name along with the path. 
   407     \param name. The graphics name along with the path. 
   396     \sa unRatedIconName()
   408     \sa unRatedIconName()
   397 */
   409 */