e PaintUtils::transition
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=866417
This commit is contained in:
parent
58e9d2c40f
commit
5f51803436
@ -26,6 +26,7 @@
|
|||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
|
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
|
#include <plasma/paintutils.h>
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
@ -219,16 +220,15 @@ void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
|
|
||||||
const qreal progress = d->animHighlightFrame;
|
const qreal progress = d->animHighlightFrame;
|
||||||
|
|
||||||
|
if (qFuzzyCompare(qreal(1.0), progress)) {
|
||||||
if (progress <= 0.9) {
|
|
||||||
d->icon.paint(painter, QRect(iconPos, iconSize()), Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress > 0.1) {
|
|
||||||
painter->save();
|
|
||||||
painter->setOpacity(progress);
|
|
||||||
d->icon.paint(painter, QRect(iconPos, iconSize()));
|
d->icon.paint(painter, QRect(iconPos, iconSize()));
|
||||||
painter->restore();
|
} else if (qFuzzyCompare(qreal(1.0), 1 + progress)) {
|
||||||
|
d->icon.paint(painter, QRect(iconPos, iconSize()), Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
|
||||||
|
} else {
|
||||||
|
QPixmap disabled = d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
QPixmap enabled = d->icon.pixmap(iconSize());
|
||||||
|
QPixmap result = PaintUtils::transition(d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off), d->icon.pixmap(iconSize()), progress);
|
||||||
|
painter->drawPixmap(QRect(iconPos, iconSize()), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
|
#include <plasma/paintutils.h>
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
@ -180,17 +181,16 @@ void PanelToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
iconRect = QRect(QPoint((int)boundingRect().left() - iconSize().width() + 1, gradientCenter.y() - iconSize().height()/2), iconSize());
|
iconRect = QRect(QPoint((int)boundingRect().left() - iconSize().width() + 1, gradientCenter.y() - iconSize().height()/2), iconSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress <= 0.9) {
|
if (qFuzzyCompare(qreal(1.0), progress)) {
|
||||||
d->icon.paint(painter, iconRect, Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress > 0.1) {
|
|
||||||
painter->save();
|
|
||||||
painter->setOpacity(progress);
|
|
||||||
d->icon.paint(painter, iconRect);
|
d->icon.paint(painter, iconRect);
|
||||||
painter->restore();
|
} else if (qFuzzyCompare(qreal(1.0), 1 + progress)) {
|
||||||
|
d->icon.paint(painter, iconRect, Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
|
||||||
|
} else {
|
||||||
|
QPixmap disabled = d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
QPixmap enabled = d->icon.pixmap(iconSize());
|
||||||
|
QPixmap result = PaintUtils::transition(d->icon.pixmap(iconSize(), QIcon::Disabled, QIcon::Off), d->icon.pixmap(iconSize()), progress);
|
||||||
|
painter->drawPixmap(iconRect, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath PanelToolBox::shape() const
|
QPainterPath PanelToolBox::shape() const
|
||||||
|
Loading…
Reference in New Issue
Block a user