226{
229
231 {
233 }
234 else
235 {
236 QStylePainter paint(this);
237 QStyleOptionToolButton opt;
238 initStyleOption(&opt);
240 paint.drawComplexControl(QStyle::CC_ToolButton, opt);
241 const QSize halfIconSize = this->
iconSize() / 2;
242 const QSize halfButtonSize = this->
size() / 2;
243 const QRect editRect =
kisGrowRect(QRect(QPoint(halfButtonSize.width() - halfIconSize.width(), halfButtonSize.height() - halfIconSize.height()),this->iconSize()), -1);
244 const int size = qMin(editRect.width(), editRect.height());
245
246 if( validColorFilter )
247 {
250 if (!opt.icon.isNull()) {
251 QRadialGradient radGradient = QRadialGradient(editRect.center(), size);
252 QColor shadowTransparent = palette().shadow().color();
253 shadowTransparent.setAlpha(96);
254 radGradient.setColorAt(0.0f, shadowTransparent);
255 shadowTransparent.setAlpha(0);
256 radGradient.setColorAt(1.0f, shadowTransparent);
257 paint.setBrush(radGradient);
258 paint.setPen(Qt::NoPen);
259 paint.drawEllipse(editRect.center(), size, size);
260 opt.icon.paint(&paint, editRect);
261 }
262 }
263 }
264 }
265}
int iconSize(qreal width, qreal height)
static void paintColorPie(QStylePainter &painter, const QPalette &palette, const QList< int > &selectedColors, const QRect &rect, const int &baseSize)
QVector< QColor > allColorLabels() const
T kisGrowRect(const T &rect, U offset)
int size(const Forest< T > &forest)
QIcon loadIcon(const QString &name)