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);