update after icon changed

Change-Id: I4250a95f02515e2bed0d5e97d772372b1f2a0bcc
This commit is contained in:
石博文 2017-03-13 08:02:33 +08:00
parent 67dc811f67
commit 0bc98ed93a
Notes: Deepin Code Review 2017-03-13 11:29:02 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Mon, 13 Mar 2017 11:29:02 +0800
Reviewed-on: https://cr.deepin.io/21309
Project: dde/dde-dock
Branch: refs/heads/master
3 changed files with 10 additions and 14 deletions

View File

@ -45,7 +45,10 @@ void DockItemController::setDropping(const bool dropping)
void DockItemController::refershItemsIcon() void DockItemController::refershItemsIcon()
{ {
for (auto item : m_itemList) for (auto item : m_itemList)
{
item->refershIcon(); item->refershIcon();
item->update();
}
} }
void DockItemController::updatePluginsItemOrderKey() void DockItemController::updatePluginsItemOrderKey()

View File

@ -47,13 +47,13 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, &AppItem::activeChanged); connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, &AppItem::activeChanged);
connect(m_itemEntry, &DBusDockEntry::TitlesChanged, this, &AppItem::updateTitle); connect(m_itemEntry, &DBusDockEntry::TitlesChanged, this, &AppItem::updateTitle);
connect(m_itemEntry, &DBusDockEntry::IconChanged, this, &AppItem::updateIcon); connect(m_itemEntry, &DBusDockEntry::IconChanged, this, &AppItem::refershIcon);
connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update)); connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries); connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries);
updateTitle(); updateTitle();
updateIcon(); refershIcon();
} }
const QString AppItem::appId() const const QString AppItem::appId() const
@ -96,12 +96,6 @@ int AppItem::itemBaseWidth()
return itemBaseHeight() * 1.4; return itemBaseHeight() * 1.4;
} }
void AppItem::refershIcon()
{
updateIcon();
update();
}
int AppItem::itemBaseHeight() int AppItem::itemBaseHeight()
{ {
if (DockDisplayMode == Efficient) if (DockDisplayMode == Efficient)
@ -310,7 +304,7 @@ void AppItem::resizeEvent(QResizeEvent *e)
{ {
DockItem::resizeEvent(e); DockItem::resizeEvent(e);
updateIcon(); refershIcon();
} }
void AppItem::dragEnterEvent(QDragEnterEvent *e) void AppItem::dragEnterEvent(QDragEnterEvent *e)
@ -398,7 +392,7 @@ void AppItem::updateTitle()
update(); update();
} }
void AppItem::updateIcon() void AppItem::refershIcon()
{ {
const QString icon = m_itemEntry->icon(); const QString icon = m_itemEntry->icon();
const int iconSize = qMin(width(), height()); const int iconSize = qMin(width(), height());
@ -411,6 +405,8 @@ void AppItem::updateIcon()
m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.6); m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.6);
m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8); m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8);
} }
update();
} }
void AppItem::activeChanged() void AppItem::activeChanged()

View File

@ -21,9 +21,6 @@ public:
inline ItemType itemType() const {return App;} inline ItemType itemType() const {return App;}
public slots:
void refershIcon();
private: private:
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
void mouseReleaseEvent(QMouseEvent *e); void mouseReleaseEvent(QMouseEvent *e);
@ -42,7 +39,7 @@ private:
private slots: private slots:
void updateTitle(); void updateTitle();
void updateIcon(); void refershIcon();
void activeChanged(); void activeChanged();
private: private: