Rating Widget¶
A star rating input widget for collecting user ratings.
Preview
FXRatingWidget
¶
Bases: ,
A clickable star rating widget.
This widget provides a configurable star rating with: - Configurable max stars - Half-star support (optional) - Hover preview - Theme-aware icons
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
Parent widget. |
None
|
|
|
Maximum number of stars. |
5
|
|
|
Initial rating value. |
0
|
|
|
Whether to allow half-star ratings. |
False
|
|
|
Size of star icons in pixels. |
20
|
|
|
Icon name for filled stars. |
'star'
|
|
|
Icon name for empty stars. |
'star_border'
|
|
|
Icon name for half-filled stars. |
'star_half'
|
Signals
rating_changed: Emitted when the rating changes.
Examples:
>>> rating = FXRatingWidget(max_rating=5, initial_rating=3)
>>> rating.rating_changed.connect(lambda r: print(f"Rating: {r}"))
Methods:
| Name | Description |
|---|---|
|
Clear the rating (set to 0). |
|
Handle mouse enter. |
|
Return the current rating. |
|
Handle mouse leave to clear hover. |
|
Handle mouse move for hover preview. |
|
Handle mouse click to set rating. |
|
Set the rating value. |
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
Return the current rating. |