update() on icon config changes

BUG:181298

svn path=/branches/KDE/4.2/kdelibs/; revision=913905
This commit is contained in:
Aaron J. Seigo 2009-01-20 02:39:27 +00:00
parent 20f4e402d8
commit 35cd88ab4e
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); 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) IconAction::IconAction(IconWidget *icon, QAction *action)
: m_icon(icon), : m_icon(icon),
m_action(action), m_action(action),
@ -296,8 +309,9 @@ IconWidget::~IconWidget()
void IconWidgetPrivate::init() void IconWidgetPrivate::init()
{ {
readColors(); readColors();
QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(readColors())); QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(colorConfigChanged()));
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(readColors())); QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorConfigChanged()));
QObject::connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), q, SLOT(iconConfigChanged()));
// setAcceptedMouseButtons(Qt::LeftButton); // setAcceptedMouseButtons(Qt::LeftButton);
q->setAcceptsHoverEvents(true); q->setAcceptsHoverEvents(true);
@ -517,6 +531,7 @@ void IconWidget::setSvg(const QString &svgFilePath, const QString &elementId)
d->iconSvg->setContainsMultipleImages(!elementId.isNull()); d->iconSvg->setContainsMultipleImages(!elementId.isNull());
d->iconSvgElement = elementId; d->iconSvgElement = elementId;
d->iconSvgElementChanged = true; d->iconSvgElementChanged = true;
d->icon = QIcon();
update(); update();
} }

View File

@ -281,8 +281,9 @@ private:
Q_PRIVATE_SLOT(d, void clearAction()) Q_PRIVATE_SLOT(d, void clearAction())
Q_PRIVATE_SLOT(d, void svgChanged()) Q_PRIVATE_SLOT(d, void svgChanged())
Q_PRIVATE_SLOT(d, void actionDestroyed(QObject *obj)) 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 hoverAnimationUpdate(qreal progress))
Q_PRIVATE_SLOT(d, void colorConfigChanged())
Q_PRIVATE_SLOT(d, void iconConfigChanged())
IconWidgetPrivate * const d; IconWidgetPrivate * const d;
friend class IconWidgetPrivate; friend class IconWidgetPrivate;

View File

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