Performance optimization: only change the icon if it's actually a different icon. Mainly affects uiserver widgets atm.

Oh, and warning--.


svn path=/trunk/KDE/kdelibs/; revision=894878
This commit is contained in:
Rob Scheepmaker 2008-12-09 14:04:33 +00:00
parent e166600984
commit b321b2f033
2 changed files with 9 additions and 2 deletions

View File

@ -185,14 +185,18 @@ QGraphicsItem *ExtenderItem::widget() const
void ExtenderItem::setIcon(const QIcon &icon)
{
d->iconName = QString();
d->collapseIcon->setIcon(icon);
}
void ExtenderItem::setIcon(const QString &icon)
{
if (icon != d->iconName) {
d->collapseIcon->setIcon(icon);
d->iconName = icon;
config().writeEntry("extenderIconName", icon);
}
}
QIcon ExtenderItem::icon() const
{
@ -480,6 +484,8 @@ void ExtenderItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
void ExtenderItem::moveEvent(QGraphicsSceneMoveEvent *event)
{
Q_UNUSED(event);
if (d->toplevel) {
d->toplevel->setSceneRect(sceneBoundingRect());
update();

View File

@ -80,6 +80,7 @@ class ExtenderItemPrivate
QString title;
QString name;
QString iconName;
uint extenderItemId;