From 9d262c3619ff77a43175586b2db1359a4c3e8974 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 20 Jan 2009 02:37:52 +0000 Subject: [PATCH] update() on icon config changes BUG:181298 svn path=/trunk/KDE/kdelibs/; revision=913904 --- widgets/iconwidget.cpp | 19 +++++++++++++++++-- widgets/iconwidget.h | 3 ++- widgets/iconwidget_p.h | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/widgets/iconwidget.cpp b/widgets/iconwidget.cpp index 29057648c..939a04957 100644 --- a/widgets/iconwidget.cpp +++ b/widgets/iconwidget.cpp @@ -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(); } diff --git a/widgets/iconwidget.h b/widgets/iconwidget.h index 2b9537b7d..2033742da 100644 --- a/widgets/iconwidget.h +++ b/widgets/iconwidget.h @@ -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; diff --git a/widgets/iconwidget_p.h b/widgets/iconwidget_p.h index e7b0f7322..7e1b61a91 100644 --- a/widgets/iconwidget_p.h +++ b/widgets/iconwidget_p.h @@ -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);