update() on icon config changes

BUG:181298

svn path=/trunk/KDE/kdelibs/; revision=913904
This commit is contained in:
Aaron J. Seigo 2009-01-20 02:37:52 +00:00
parent 65268e77d4
commit 9d262c3619
3 changed files with 21 additions and 3 deletions

View File

@ -88,6 +88,19 @@ void IconWidgetPrivate::readColors()
shadowColor = Plasma::Theme::defaultTheme()->color(Theme::BackgroundColor);
}
void IconWidgetPrivate::colorConfigChanged()
{
readColors();
q->update();
}
void IconWidgetPrivate::iconConfigChanged()
{
if (!icon.isNull()) {
q->update();
}
}
IconAction::IconAction(IconWidget *icon, QAction *action)
: m_icon(icon),
m_action(action),
@ -296,8 +309,9 @@ IconWidget::~IconWidget()
void IconWidgetPrivate::init()
{
readColors();
QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(readColors()));
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(readColors()));
QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(colorConfigChanged()));
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorConfigChanged()));
QObject::connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), q, SLOT(iconConfigChanged()));
// setAcceptedMouseButtons(Qt::LeftButton);
q->setAcceptsHoverEvents(true);
@ -521,6 +535,7 @@ void IconWidget::setSvg(const QString &svgFilePath, const QString &elementId)
d->iconSvg->setContainsMultipleImages(!elementId.isNull());
d->iconSvgElement = elementId;
d->iconSvgElementChanged = true;
d->icon = QIcon();
update();
}

View File

@ -281,8 +281,9 @@ private:
Q_PRIVATE_SLOT(d, void clearAction())
Q_PRIVATE_SLOT(d, void svgChanged())
Q_PRIVATE_SLOT(d, void actionDestroyed(QObject *obj))
Q_PRIVATE_SLOT(d, void readColors())
Q_PRIVATE_SLOT(d, void hoverAnimationUpdate(qreal progress))
Q_PRIVATE_SLOT(d, void colorConfigChanged())
Q_PRIVATE_SLOT(d, void iconConfigChanged())
IconWidgetPrivate * const d;
friend class IconWidgetPrivate;

View File

@ -180,6 +180,8 @@ public:
void actionDestroyed(QObject *obj);
void readColors();
void colorConfigChanged();
void iconConfigChanged();
void hoverAnimationUpdate(qreal progress);
void init();
void layoutIcons(const QStyleOptionGraphicsItem *option);