From bdcb4a1ae2b041280deade11d173f04529518fe3 Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 7 Nov 2023 17:04:39 +0800 Subject: [PATCH 1/2] chore: reduce warnings warning: comparison of different enumeration types in switch statement ('QVariant::Type' and 'QMetaType::Type') --- src/dnativesettings.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dnativesettings.cpp b/src/dnativesettings.cpp index f5b0bc20..c18130c2 100644 --- a/src/dnativesettings.cpp +++ b/src/dnativesettings.cpp @@ -146,7 +146,11 @@ void DNativeSettings::init(const QMetaObject *metaObject) QMetaPropertyBuilder op; - switch (mp.type()) { +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + switch (mp.metaType()) { +#else + switch (static_cast(mp.type())) { +#endif case QMetaType::QByteArray: case QMetaType::QString: case QMetaType::QColor: From 5a69311c535c06316cbc5659a68410cfb2051d06 Mon Sep 17 00:00:00 2001 From: ck Date: Wed, 8 Nov 2023 10:04:10 +0800 Subject: [PATCH 2/2] fix: DPlatformTheme::property not work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buildNativeSettings 之后 metaobject 被替换了 不会走原来的 read 方法了。 读写属性时如果是 base 对象原始属性 fallback 到 base 对象的 qt_metacall 方法 Issue: linuxdeepin/dtk#101 --- src/dnativesettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dnativesettings.cpp b/src/dnativesettings.cpp index c18130c2..065f1914 100644 --- a/src/dnativesettings.cpp +++ b/src/dnativesettings.cpp @@ -415,7 +415,7 @@ int DNativeSettings::metaCall(QMetaObject::Call _c, int _id, void ** _a) const int index = p.propertyIndex(); // 对于本地属性,此处应该从m_settings中读写 if (Q_LIKELY(index != m_flagPropertyIndex && index != m_allKeysPropertyIndex - && index >= m_firstProperty)) { + && index >= m_firstProperty + m_propertyCount)) { switch (_c) { case QMetaObject::ReadProperty: *reinterpret_cast(_a[1]) = m_settings->setting(p.name());