# class KRatingWidget

###

Module | nepomuk
Namespace |
Class | KRatingWidget
Inherits | QFrame

Displays a rating value as a row of pixmaps.

The KRatingWidget displays a range of stars or other arbitrary pixmaps and allows the user to select a certain number by mouse.

See also KRatingPainter

Author Sebastian Trueg <trueg@kde.org>

### methods

- KRatingWidget (parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0

  Creates a new rating widget.

- alignment ( )

  returns Qt.Alignment

  The alignment of the stars.

  See also setAlignment

- halfStepsEnabled ( )

  returns bool

  If half steps are enabled one star equals to 2 rating points and uneven rating values result in half-stars being drawn.

  See also setHalfStepsEnabled

- icon ( )

  returns QIcon

  The icon used to draw a star. In case a custom pixmap has been set this value is ignored.

  See also setIcon, setCustomPixmap

- layoutDirection ( )

  returns Qt.LayoutDirection

  The layout direction. If RTL the stars representing the rating value will be drawn from the right.

  See also setLayoutDirection

- leaveEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QEvent |

- maxRating ( )

  returns int

  Returns the maximum possible rating.

- mouseMoveEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QMouseEvent |

- mousePressEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QMouseEvent |

- paintEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QPaintEvent |

- rating ( )

  returns unsigned int

  Returns The current rating.

- ratingChanged (rating)

  returns Nothing
  SIGNAL ("ratingChanged (unsigned int)")

  Argument | Type | Default
  --- | --- | ---
  rating | unsigned int |

  Emitted if the rating is changed by user interaction (ie. mouse click). A call to setRating does not trigger this signal.

- ratingChanged (rating)

  returns Nothing
  SIGNAL ("ratingChanged (int)")

  Argument | Type | Default
  --- | --- | ---
  rating | int |

- resizeEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QResizeEvent |

- setAlignment (align)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  align | Qt.Alignment |

  The alignment of the stars in the drawing rect. All alignment flags are supported.

- setCustomPixmap (pixmap)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  pixmap | QPixmap |

  Set a custom pixmap.

- setHalfStepsEnabled (enabled)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enabled | bool |

  If half steps are enabled (the default) then one rating step corresponds to half a star.

- setIcon (icon)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  icon | QIcon |

  Set a custom icon. Defaults to "rating".

- setLayoutDirection (direction)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  direction | Qt.LayoutDirection |

  LTR or RTL

- setMaxRating (max)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  max | int |

  Set the maximum allowed rating value. The default is 10 which means that a rating from 1 to 10 is selectable. If max is uneven steps are automatically only allowed full.

- setMaxRating (max)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  max | unsigned int |

  Deprecated use setMaxRating( int max )

- setOnlyPaintFullSteps (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | bool |

  Deprecated Use setHalfStepsEnabled

- setPixmap (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QPixmap |

  Set the pixap to be used to display a rating step. By default the "rating" pixmap is loaded.

  Deprecated use setCustomPixmap

- setPixmapSize (size)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  size | int |

  Set the recommended size of the pixmaps. This is only used for the sizeHint. The actual size is always dependant on the size of the widget itself.

- setRating (rating)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  rating | int |

  Set the current rating. Calling this method will NOT trigger the ratingChanged signal.

- setRating (rating)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  rating | unsigned int |

  Deprecated use setRating( int max )

- setSpacing (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

  Set the spacing between the pixmaps. The default is 0.

- sizeHint ( )

  returns QSize

- spacing ( )

  returns int

  The spacing between the rating stars.

  See also setSpacing