Changeset View
Changeset View
Standalone View
Standalone View
src/kratingwidget.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 49 | { | |||
---|---|---|---|---|---|
50 | setMouseTracking(true); | 50 | setMouseTracking(true); | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | KRatingWidget::~KRatingWidget() | 53 | KRatingWidget::~KRatingWidget() | ||
54 | { | 54 | { | ||
55 | delete d; | 55 | delete d; | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | #ifndef KWIDGETSADDONS_NO_DEPRECATED | 58 | #if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) | ||
59 | void KRatingWidget::setPixmap(const QPixmap &pix) | 59 | void KRatingWidget::setPixmap(const QPixmap &pix) | ||
60 | { | 60 | { | ||
61 | setCustomPixmap(pix); | 61 | setCustomPixmap(pix); | ||
62 | } | 62 | } | ||
63 | #endif | 63 | #endif | ||
64 | 64 | | |||
65 | void KRatingWidget::setCustomPixmap(const QPixmap &pix) | 65 | void KRatingWidget::setCustomPixmap(const QPixmap &pix) | ||
66 | { | 66 | { | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 127 | { | |||
128 | return d->ratingPainter.maxRating(); | 128 | return d->ratingPainter.maxRating(); | ||
129 | } | 129 | } | ||
130 | 130 | | |||
131 | bool KRatingWidget::halfStepsEnabled() const | 131 | bool KRatingWidget::halfStepsEnabled() const | ||
132 | { | 132 | { | ||
133 | return d->ratingPainter.halfStepsEnabled(); | 133 | return d->ratingPainter.halfStepsEnabled(); | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | #ifndef KWIDGETSADDONS_NO_DEPRECATED | 136 | #if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) | ||
137 | void KRatingWidget::setRating(unsigned int rating) | 137 | void KRatingWidget::setRating(unsigned int rating) | ||
138 | { | 138 | { | ||
139 | setRating((int)rating); | 139 | setRating((int)rating); | ||
140 | } | 140 | } | ||
141 | #endif | 141 | #endif | ||
142 | 142 | | |||
143 | void KRatingWidget::setRating(int rating) | 143 | void KRatingWidget::setRating(int rating) | ||
144 | { | 144 | { | ||
145 | if (rating != d->rating) { | 145 | if (rating != d->rating) { | ||
146 | d->rating = rating; | 146 | d->rating = rating; | ||
147 | d->hoverRating = rating; | 147 | d->hoverRating = rating; | ||
148 | emit ratingChanged(rating); | 148 | emit ratingChanged(rating); | ||
149 | emit ratingChanged((unsigned int)rating); | 149 | emit ratingChanged((unsigned int)rating); | ||
150 | update(); | 150 | update(); | ||
151 | } | 151 | } | ||
152 | } | 152 | } | ||
153 | 153 | | |||
154 | #ifndef KWIDGETSADDONS_NO_DEPRECATED | 154 | #if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) | ||
155 | void KRatingWidget::setMaxRating(unsigned int max) | 155 | void KRatingWidget::setMaxRating(unsigned int max) | ||
156 | { | 156 | { | ||
157 | setMaxRating((int)max); | 157 | setMaxRating((int)max); | ||
158 | } | 158 | } | ||
159 | #endif | 159 | #endif | ||
160 | 160 | | |||
161 | void KRatingWidget::setMaxRating(int max) | 161 | void KRatingWidget::setMaxRating(int max) | ||
162 | { | 162 | { | ||
163 | d->ratingPainter.setMaxRating(max); | 163 | d->ratingPainter.setMaxRating(max); | ||
164 | update(); | 164 | update(); | ||
165 | } | 165 | } | ||
166 | 166 | | |||
167 | void KRatingWidget::setHalfStepsEnabled(bool enabled) | 167 | void KRatingWidget::setHalfStepsEnabled(bool enabled) | ||
168 | { | 168 | { | ||
169 | d->ratingPainter.setHalfStepsEnabled(enabled); | 169 | d->ratingPainter.setHalfStepsEnabled(enabled); | ||
170 | update(); | 170 | update(); | ||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | #ifndef KWIDGETSADDONS_NO_DEPRECATED | 173 | #if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) | ||
174 | void KRatingWidget::setOnlyPaintFullSteps(bool fs) | 174 | void KRatingWidget::setOnlyPaintFullSteps(bool fs) | ||
175 | { | 175 | { | ||
176 | setHalfStepsEnabled(!fs); | 176 | setHalfStepsEnabled(!fs); | ||
177 | } | 177 | } | ||
178 | #endif | 178 | #endif | ||
179 | 179 | | |||
180 | static inline int adjustedHoverRating(bool halfStep, int hoverRating, int rating) | 180 | static inline int adjustedHoverRating(bool halfStep, int hoverRating, int rating) | ||
181 | { | 181 | { | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |