disabled and paused state support
svn path=/trunk/KDE/kdelibs/; revision=964482
This commit is contained in:
parent
91a65043c1
commit
ef6d0641dd
@ -129,9 +129,7 @@ void BusyWidget::timerEvent(QTimerEvent *event)
|
||||
update();
|
||||
}
|
||||
|
||||
void BusyWidget::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
void BusyWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
@ -141,30 +139,39 @@ void BusyWidget::paint(QPainter *painter,
|
||||
QRect spinnerRect(QPoint(0, 0), QSize(qMin(size().width(), size().height()), qMin(size().width(), size().height())));
|
||||
spinnerRect.moveCenter(QPoint(size().width()/2, size().height()/2));
|
||||
|
||||
if (!d->frames[intRotation]) {
|
||||
QPointF translatedPos(spinnerRect.width()/2, spinnerRect.height()/2);
|
||||
|
||||
d->frames[intRotation] = QPixmap(spinnerRect.size());
|
||||
d->frames[intRotation].fill(Qt::transparent);
|
||||
|
||||
QPainter buffPainter(&d->frames[intRotation]);
|
||||
|
||||
buffPainter.setRenderHints(QPainter::SmoothPixmapTransform);
|
||||
buffPainter.translate(translatedPos);
|
||||
|
||||
if (d->svg->hasElement("busywidget-shadow")) {
|
||||
buffPainter.save();
|
||||
buffPainter.translate(2,2);
|
||||
buffPainter.rotate(intRotation);
|
||||
d->svg->paint(&buffPainter, QRect(-translatedPos.toPoint(), spinnerRect.size()), "busywidget-shadow");
|
||||
buffPainter.restore();
|
||||
}
|
||||
|
||||
buffPainter.rotate(intRotation);
|
||||
d->svg->paint(&buffPainter, QRect(-translatedPos.toPoint(), spinnerRect.size()), "busywidget");
|
||||
if (!isEnabled()) {
|
||||
painter->setOpacity(painter->opacity() / 2);
|
||||
}
|
||||
|
||||
if (!d->running && d->svg->hasElement("paused")) {
|
||||
d->svg->paint(painter, spinnerRect, "paused");
|
||||
} else {
|
||||
if (!d->frames[intRotation]) {
|
||||
QPointF translatedPos(spinnerRect.width()/2, spinnerRect.height()/2);
|
||||
|
||||
d->frames[intRotation] = QPixmap(spinnerRect.size());
|
||||
d->frames[intRotation].fill(Qt::transparent);
|
||||
|
||||
QPainter buffPainter(&d->frames[intRotation]);
|
||||
|
||||
buffPainter.setRenderHints(QPainter::SmoothPixmapTransform);
|
||||
buffPainter.translate(translatedPos);
|
||||
|
||||
if (d->svg->hasElement("busywidget-shadow")) {
|
||||
buffPainter.save();
|
||||
buffPainter.translate(2,2);
|
||||
buffPainter.rotate(intRotation);
|
||||
d->svg->paint(&buffPainter, QRect(-translatedPos.toPoint(), spinnerRect.size()), "busywidget-shadow");
|
||||
buffPainter.restore();
|
||||
}
|
||||
|
||||
buffPainter.rotate(intRotation);
|
||||
d->svg->paint(&buffPainter, QRect(-translatedPos.toPoint(), spinnerRect.size()), "busywidget");
|
||||
}
|
||||
|
||||
painter->drawPixmap(spinnerRect.topLeft(), d->frames[intRotation]);
|
||||
}
|
||||
|
||||
painter->drawPixmap(spinnerRect.topLeft(), d->frames[intRotation]);
|
||||
painter->setPen(Plasma::Theme::defaultTheme()->color(Theme::HighlightColor));
|
||||
painter->drawText(boundingRect(), d->label, QTextOption(Qt::AlignVCenter | Qt::AlignHCenter));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user