KWidgetsAddons
kratingpainter.cpp
59 // The icon might have already been monochrome, so we also need to make it semi-transparent to see a difference.
181void KRatingPainter::paint(QPainter *painter, const QRect &rect, int rating, int hoverRating) const
204 QImage disabledRatingImage = disabledRatingPix.toImage().convertToFormat(QImage::Format_ARGB32);
267 d->direction == Qt::RightToLeft ? (numHoverStars > 0 ? hoverPix : disabledRatingPix) : ratingPix,
276 d->direction == Qt::RightToLeft ? ratingPix : (numHoverStars > 0 ? hoverPix : disabledRatingPix),
365void KRatingPainter::paintRating(QPainter *painter, const QRect &rect, Qt::Alignment align, int rating, int hoverRating)
373int KRatingPainter::getRatingFromPosition(const QRect &rect, Qt::Alignment align, Qt::LayoutDirection direction, const QPoint &pos)
Utility class that draws a row of stars for a rating value.
Definition kratingpainter.h:38
static void paintRating(QPainter *p, const QRect &rect, Qt::Alignment align, int rating, int hoverRating=-1)
Convenience method that paints a rating into the given rect.
Definition kratingpainter.cpp:365
int ratingFromPosition(const QRect &rect, const QPoint &pos) const
Calculate the rating value from mouse position pos.
Definition kratingpainter.cpp:316
void setAlignment(Qt::Alignment align)
The alignment of the stars in the drawing rect.
Definition kratingpainter.cpp:123
bool halfStepsEnabled() const
If half steps are enabled one star equals to 2 rating points and uneven rating values result in half-...
Definition kratingpainter.cpp:78
bool isEnabled() const
The rating can be painted in a disabled state where no color is used and hover ratings are ignored.
Definition kratingpainter.cpp:98
void setSpacing(int spacing)
Set the spacing between rating pixmaps.
Definition kratingpainter.cpp:148
static int getRatingFromPosition(const QRect &rect, Qt::Alignment align, Qt::LayoutDirection direction, const QPoint &pos)
Get the rating that would be selected if the user clicked position pos within rect if the rating has ...
Definition kratingpainter.cpp:373
void setHalfStepsEnabled(bool enabled)
If half steps are enabled (the default) then one rating step corresponds to half a star.
Definition kratingpainter.cpp:118
void paint(QPainter *painter, const QRect &rect, int rating, int hoverRating=-1) const
Draw the rating.
Definition kratingpainter.cpp:181
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
State
QIcon fromTheme(const QString &name)
bool hasThemeIcon(const QString &name)
Format_ARGB32
uchar * bits()
QImage convertToFormat(Format format, Qt::ImageConversionFlags flags) &&
int height() const const
int width() const const
qreal devicePixelRatio() const const
QPaintDevice * device() const const
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
Qt::LayoutDirection layoutDirection() const const
QSizeF deviceIndependentSize() const const
qreal devicePixelRatio() const const
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
int height() const const
bool isNull() const const
QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
QSize size() const const
QImage toImage() const const
int width() const const
int x() const const
int bottom() const const
int height() const const
int left() const const
int right() const const
int top() const const
int width() const const
int x() const const
int y() const const
int height() const const
int width() const const
QSize toSize() const const
typedef Alignment
LayoutDirection
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:58:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:58:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.