From 0bc98ed93a0017fe2b9cdf944b8266698a4a9c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=8D=9A=E6=96=87?= Date: Mon, 13 Mar 2017 08:02:33 +0800 Subject: [PATCH] update after icon changed Change-Id: I4250a95f02515e2bed0d5e97d772372b1f2a0bcc --- frame/controller/dockitemcontroller.cpp | 3 +++ frame/item/appitem.cpp | 16 ++++++---------- frame/item/appitem.h | 5 +---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/frame/controller/dockitemcontroller.cpp b/frame/controller/dockitemcontroller.cpp index 1325c5403..ece15a389 100644 --- a/frame/controller/dockitemcontroller.cpp +++ b/frame/controller/dockitemcontroller.cpp @@ -45,7 +45,10 @@ void DockItemController::setDropping(const bool dropping) void DockItemController::refershItemsIcon() { for (auto item : m_itemList) + { item->refershIcon(); + item->update(); + } } void DockItemController::updatePluginsItemOrderKey() diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index 248cfb665..e2c0dc756 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -47,13 +47,13 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, &AppItem::activeChanged); 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(&AppItem::update)); connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries); updateTitle(); - updateIcon(); + refershIcon(); } const QString AppItem::appId() const @@ -96,12 +96,6 @@ int AppItem::itemBaseWidth() return itemBaseHeight() * 1.4; } -void AppItem::refershIcon() -{ - updateIcon(); - update(); -} - int AppItem::itemBaseHeight() { if (DockDisplayMode == Efficient) @@ -310,7 +304,7 @@ void AppItem::resizeEvent(QResizeEvent *e) { DockItem::resizeEvent(e); - updateIcon(); + refershIcon(); } void AppItem::dragEnterEvent(QDragEnterEvent *e) @@ -398,7 +392,7 @@ void AppItem::updateTitle() update(); } -void AppItem::updateIcon() +void AppItem::refershIcon() { const QString icon = m_itemEntry->icon(); const int iconSize = qMin(width(), height()); @@ -411,6 +405,8 @@ void AppItem::updateIcon() m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.6); m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8); } + + update(); } void AppItem::activeChanged() diff --git a/frame/item/appitem.h b/frame/item/appitem.h index 6109122a9..1dd44f7da 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -21,9 +21,6 @@ public: inline ItemType itemType() const {return App;} -public slots: - void refershIcon(); - private: void paintEvent(QPaintEvent *e); void mouseReleaseEvent(QMouseEvent *e); @@ -42,7 +39,7 @@ private: private slots: void updateTitle(); - void updateIcon(); + void refershIcon(); void activeChanged(); private: