diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 189078d2..41cc25dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,12 @@ find_package(ICU REQUIRED COMPONENTS uc) pkg_check_modules(uchardet REQUIRED uchardet) # end text encoding +# 为不包含实际QObject类的头文件跳过AutoMOC处理 +set_property(SOURCE ../include/base/dsingleton.h PROPERTY SKIP_AUTOMOC ON) +if("${DTK_VERSION_MAJOR}" STREQUAL "6") + set_property(SOURCE ../include/util/dthreadutils.h PROPERTY SKIP_AUTOMOC ON) +endif() + # start base include(base/base.cmake) # end base diff --git a/src/dconfig.cpp b/src/dconfig.cpp index 2d57ee5d..a2c59f60 100644 --- a/src/dconfig.cpp +++ b/src/dconfig.cpp @@ -173,13 +173,13 @@ class Q_DECL_HIDDEN FileBackend : public DConfigBackend if (owner->appId == NoAppId) return true; - QScopedPointer file(new DConfigFile(NoAppId, owner->name, owner->subpath)); + std::unique_ptr file(new DConfigFile(NoAppId, owner->name, owner->subpath)); const bool canFallbackToGeneric = !file->meta()->metaPath(prefix).isEmpty(); if (canFallbackToGeneric) { - QScopedPointer cache(file->createUserCache(getuid())); + std::unique_ptr cache(file->createUserCache(getuid())); if (file->load(prefix) && cache->load(prefix)) { - genericConfigFile.reset(file.take()); - genericConfigCache.reset(cache.take()); + genericConfigFile.reset(file.release()); + genericConfigCache.reset(cache.release()); } } return true; @@ -370,7 +370,7 @@ class Q_DECL_HIDDEN DBusBackend : public DConfigBackend complexType >> list; QVariantList res; res.reserve(list.size()); - for (const auto &item : qAsConst(list)) { + for (const auto &item : std::as_const(list)) { res << decodeQDBusArgument(item); } return res; diff --git a/src/util/drecentmanager.cpp b/src/util/drecentmanager.cpp index 6129d314..ce2f7548 100644 --- a/src/util/drecentmanager.cpp +++ b/src/util/drecentmanager.cpp @@ -13,6 +13,7 @@ #include #if QT_VERSION >= QT_VERSION_CHECK(6,0,0) #include +#include #endif DCORE_BEGIN_NAMESPACE @@ -67,7 +68,11 @@ bool DRecentManager::addItem(const QString &uri, DRecentData &data) QFile file(RECENT_PATH); file.open(QIODevice::ReadWrite | QIODevice::Text); +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + QString dateTime = QDateTime::currentDateTime().toTimeZone(QTimeZone::UTC).toString(Qt::ISODate); +#else QString dateTime = QDateTime::currentDateTime().toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate); +#endif QDomDocument doc; if (!doc.setContent(&file)) {