228{
231
233 {
235 }
236 else
237 {
238 QStylePainter paint(this);
239 QStyleOptionToolButton opt;
240 initStyleOption(&opt);
242 paint.drawComplexControl(QStyle::CC_ToolButton, opt);
243 const QSize halfIconSize = this->
iconSize() / 2;
244 const QSize halfButtonSize = this->
size() / 2;
245 const QRect editRect =
kisGrowRect(QRect(QPoint(halfButtonSize.width() - halfIconSize.width(), halfButtonSize.height() - halfIconSize.height()),this->iconSize()), -1);
246 const int size = qMin(editRect.width(), editRect.height());
247
248 if( validColorFilter )
249 {
252 if (!opt.icon.isNull()) {
253 QRadialGradient radGradient = QRadialGradient(editRect.center(), size);
254 QColor shadowTransparent =
palette().shadow().color();
255 shadowTransparent.setAlpha(96);
256 radGradient.setColorAt(0.0f, shadowTransparent);
257 shadowTransparent.setAlpha(0);
258 radGradient.setColorAt(1.0f, shadowTransparent);
259 paint.setBrush(radGradient);
260 paint.setPen(Qt::NoPen);
261 paint.drawEllipse(editRect.center(), size, size);
262 opt.icon.paint(&paint, editRect);
263 }
264 }
265 }
266 }
267}
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)
rgba palette[MAX_PALETTE]