From 2972f837fc3e5bdb5e319d89a35c52f715cdc86b Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Sat, 8 May 2021 10:00:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=88=E5=B9=B4=E6=9C=88=EF=BC=89=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A0=8F=E6=97=A5=E5=8E=86=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E4=B8=8A=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在刷新Icon中添加年月的判断 Log: 添加控制中心修改系统时间(年月)时,任务栏日历图标上刷新 Task: https://pms.uniontech.com/zentao/task-view-75885.html Change-Id: I9761322a277be7e5c78482c1c8bc8855f9a85f9e --- frame/item/appitem.cpp | 7 +++---- frame/item/appitem.h | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index ae0433002..8f207fe64 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -60,7 +60,6 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti , m_drag(nullptr) , m_dragging(false) , m_retryTimes(0) - , m_lastShowDay(0) , m_iconValid(false) , m_lastclickTimes(0) , m_appIcon(QPixmap()) @@ -116,10 +115,10 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged); + /** 日历 1S定时判断是否刷新icon的处理 */ connect(m_refershIconTimer, &QTimer::timeout, this, [ = ]() { - m_curDate = QDate::currentDate(); - if (m_curDate.day() != m_lastShowDay) { - m_lastShowDay = m_curDate.day(); + if (QDate::currentDate() != m_curDate) { + m_curDate = QDate::currentDate(); refreshIcon(); } }); diff --git a/frame/item/appitem.h b/frame/item/appitem.h index 50fccb5b7..a4a009d9c 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -120,7 +120,6 @@ private: bool m_dragging; bool m_active; int m_retryTimes; - int m_lastShowDay; bool m_iconValid; unsigned long m_lastclickTimes; @@ -134,9 +133,9 @@ private: QTimer *m_updateIconGeometryTimer; QTimer *m_retryObtainIconTimer; - QTimer *m_refershIconTimer; + QTimer *m_refershIconTimer; // 当APP为日历时定时(1S)检测是否刷新ICON - QDate m_curDate; + QDate m_curDate; // 保存当前icon的日期来判断是否需要更新日历APP的ICON QFutureWatcher *m_smallWatcher; QFutureWatcher *m_largeWatcher;