From 67dc811f6750602122397e67739882196cf72534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=8D=9A=E6=96=87?= Date: Tue, 7 Mar 2017 17:30:30 +0800 Subject: [PATCH] refersh launcher icon when theme changed Change-Id: I0e1e2c42944f4c6270f3ee29d2568b581687bead --- frame/item/launcheritem.cpp | 25 ++++++++++++++++--------- frame/item/launcheritem.h | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frame/item/launcheritem.cpp b/frame/item/launcheritem.cpp index e742fae01..f0d2039c2 100644 --- a/frame/item/launcheritem.cpp +++ b/frame/item/launcheritem.cpp @@ -19,6 +19,21 @@ LauncherItem::LauncherItem(QWidget *parent) "padding:5px 10px;"); } +void LauncherItem::refershIcon() +{ + const int iconSize = qMin(width(), height()); + if (DockDisplayMode == Efficient) + { + m_smallIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.7); + m_largeIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.9); + } else { + m_smallIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.6); + m_largeIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.8); + } + + update(); +} + void LauncherItem::paintEvent(QPaintEvent *e) { DockItem::paintEvent(e); @@ -40,15 +55,7 @@ void LauncherItem::resizeEvent(QResizeEvent *e) { DockItem::resizeEvent(e); - const int iconSize = qMin(width(), height()); - if (DockDisplayMode == Efficient) - { - m_smallIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.7); - m_largeIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.9); - } else { - m_smallIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.6); - m_largeIcon = ThemeAppIcon::getIcon("deepin-launcher", iconSize * 0.8); - } + refershIcon(); } void LauncherItem::mousePressEvent(QMouseEvent *e) diff --git a/frame/item/launcheritem.h b/frame/item/launcheritem.h index 8ed4d78b6..c403dd665 100644 --- a/frame/item/launcheritem.h +++ b/frame/item/launcheritem.h @@ -12,6 +12,8 @@ public: inline ItemType itemType() const {return Launcher;} + void refershIcon(); + private: void paintEvent(QPaintEvent *e); void resizeEvent(QResizeEvent *e);