refersh launcher icon when theme changed

Change-Id: I0e1e2c42944f4c6270f3ee29d2568b581687bead
This commit is contained in:
石博文 2017-03-07 17:30:30 +08:00
parent 1d68caa379
commit 67dc811f67
Notes: Deepin Code Review 2017-03-09 16:23:17 +08:00
Verified+1: Anonymous Coward #1000004
Verified+1: <yefei@linuxdeepin.com>
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Thu, 09 Mar 2017 16:23:16 +0800
Reviewed-on: https://cr.deepin.io/21141
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 18 additions and 9 deletions

View File

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

View File

@ -12,6 +12,8 @@ public:
inline ItemType itemType() const {return Launcher;}
void refershIcon();
private:
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);