KRatingWidget Class Reference
from PyKDE4.nepomuk import *
Inherits:
Detailed Description
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.
\sa KRatingPainter
- Author:
- Sebastian Trueg <trueg@kde.org>
Signals |
| ratingChanged (, int rating) |
Methods |
| __init__ (self, QWidget parent=0) |
Qt::Alignment | alignment (self) |
bool | halfStepsEnabled (self) |
QIcon | icon (self) |
Qt::LayoutDirection | layoutDirection (self) |
| leaveEvent (self, QEvent e) |
int | maxRating (self) |
| mouseMoveEvent (self, QMouseEvent e) |
| mousePressEvent (self, QMouseEvent e) |
| paintEvent (self, QPaintEvent e) |
long | rating (self) |
| ratingChanged (self, int rating) |
| resizeEvent (self, QResizeEvent e) |
| setAlignment (self, Qt::Alignment align) |
| setCustomPixmap (self, QPixmap pixmap) |
| setHalfStepsEnabled (self, bool enabled) |
| setIcon (self, QIcon icon) |
| setLayoutDirection (self, Qt::LayoutDirection direction) |
| setMaxRating (self, int max) |
| setOnlyPaintFullSteps (self, bool a0) |
| setPixmap (self, QPixmap a0) |
| setPixmapSize (self, int size) |
| setRating (self, int rating) |
| setSpacing (self, int a0) |
QSize | sizeHint (self) |
int | spacing (self) |
Method Documentation
__init__ |
( |
self, |
|
|
|
QWidget |
parent=0 |
|
) |
|
|
|
Creates a new rating widget.
The alignment of the stars.
\sa setAlignment
bool halfStepsEnabled |
( |
|
self ) |
|
If half steps are enabled one star equals to 2 rating
points and uneven rating values result in half-stars being
drawn.
\sa setHalfStepsEnabled
The icon used to draw a star. In case a custom pixmap has been set
this value is ignored.
\sa setIcon, setCustomPixmap
The layout direction. If RTL the stars
representing the rating value will be drawn from the
right.
\sa setLayoutDirection
- Returns:
- the maximum possible rating.
mouseMoveEvent |
( |
self, |
|
|
|
QMouseEvent |
e |
|
) |
|
|
|
mousePressEvent |
( |
self, |
|
|
|
QMouseEvent |
e |
|
) |
|
|
|
paintEvent |
( |
self, |
|
|
|
QPaintEvent |
e |
|
) |
|
|
|
- Returns:
- The current rating.
ratingChanged |
( |
self, |
|
|
|
int |
rating |
|
) |
|
|
|
Emitted if the rating is changed by user interaction (ie. mouse click).
A call to setRating does not trigger this signal.
- Signal syntax:
QObject.connect(source, SIGNAL("ratingChanged(int)"), target_slot)
resizeEvent |
( |
self, |
|
|
|
QResizeEvent |
e |
|
) |
|
|
|
The alignment of the stars in the drawing rect.
All alignment flags are supported.
setCustomPixmap |
( |
self, |
|
|
|
QPixmap |
pixmap |
|
) |
|
|
|
setHalfStepsEnabled |
( |
self, |
|
|
|
bool |
enabled |
|
) |
|
|
|
If half steps are enabled (the default) then
one rating step corresponds to half a star.
setIcon |
( |
self, |
|
|
|
QIcon |
icon |
|
) |
|
|
|
Set a custom icon. Defaults to "rating".
setMaxRating |
( |
self, |
|
|
|
int |
max |
|
) |
|
|
|
- Deprecated:
- use setMaxRating( int max )
setOnlyPaintFullSteps |
( |
self, |
|
|
|
bool |
a0 |
|
) |
|
|
|
- Deprecated:
- Use setHalfStepsEnabled
setPixmap |
( |
self, |
|
|
|
QPixmap |
a0 |
|
) |
|
|
|
Set the pixap to be used to display a rating step.
By default the "rating" pixmap is loaded.
- Deprecated:
- use setCustomPixmap
setPixmapSize |
( |
self, |
|
|
|
int |
size |
|
) |
|
|
|
Set the recommended size of the pixmaps. This is
only used for the sizeHint. The actual size is always
dependent on the size of the widget itself.
setRating |
( |
self, |
|
|
|
int |
rating |
|
) |
|
|
|
- Deprecated:
- use setRating( int max )
setSpacing |
( |
self, |
|
|
|
int |
a0 |
|
) |
|
|
|
Set the spacing between the pixmaps. The default is 0.
The spacing between the rating stars.
\sa setSpacing