From b637558fefcd7c94afd3d68d3fa1ae06dc2398eb Mon Sep 17 00:00:00 2001 From: zhangkun Date: Thu, 13 Jun 2024 10:09:54 +0800 Subject: [PATCH] fix: launcher application item not updating The refresh slot function was not successfully connected Issue: https://github.com/linuxdeepin/developer-center/issues/8968 --- src/models/appsmodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models/appsmodel.cpp b/src/models/appsmodel.cpp index b10a1591..7dcc1127 100644 --- a/src/models/appsmodel.cpp +++ b/src/models/appsmodel.cpp @@ -39,6 +39,7 @@ static void updateAppItemFromAM(AppItem *appItem) AppsModel::AppsModel(QObject *parent) : QStandardItemModel(parent) , m_dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel")) + , m_tmUpdateCache(new QTimer(this)) { Q_ASSERT_X(m_dconfig->isValid(), "DConfig", "DConfig file is missing or invalid"); m_excludedAppIdList = m_dconfig->value("excludeAppIdList", QStringList{}).toStringList(); @@ -60,6 +61,9 @@ AppsModel::AppsModel(QObject *parent) Q_ASSERT(duplicatedItems.isEmpty()); qDebug() << rowCount(); + m_tmUpdateCache->setInterval(1000); + m_tmUpdateCache->setSingleShot(true); + if (AppMgr::instance()->isValid()) { connect(AppMgr::instance(), &AppMgr::changed, m_tmUpdateCache, qOverload<>(&QTimer::start)); connect(AppMgr::instance(), &AppMgr::itemDataChanged, this, [this](const QString &id) { @@ -72,10 +76,6 @@ AppsModel::AppsModel(QObject *parent) }); } - m_tmUpdateCache = new QTimer(this); - m_tmUpdateCache->setInterval(1000); - m_tmUpdateCache->setSingleShot(true); - m_fwIconCache = new DFileWatcherManager(this); const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); const QString suffix("/icons/hicolor/icon-theme.cache");