diff options
author | Doris Verria <doris.verria@qt.io> | 2022-08-30 13:30:43 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-31 12:40:48 +0000 |
commit | a751de07605ab5d9b636fa1e9422e51154e3c4ce (patch) | |
tree | 31d6975af36ae60455a2357d42a0691e5ee4e3ce | |
parent | 32c180439eba1a8fa7d351e0bab9f44e59ecf2c7 (diff) |
iOS Style: Make the theme property read-only
We had marked the iOS Style's theme property as a writable property.
However, setting the theme through it was not supported. It also
doesn't make sense to set the theme through this attached property
since in the QPA layer we set the appearance(theme) and subscribe to
theme changes based on the traitCollection property of the UIWindow,
which changes based on system-wide configurations.
Change-Id: I36191a47d8892dff3069901e16abad82b9f9f82e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit c0f50622c7d75915e1a2f167b9bcfe6702f5dcb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quickcontrols2/doc/src/qtquickcontrols2-ios.qdoc | 3 | ||||
-rw-r--r-- | src/quickcontrols2/ios/qquickiosstyle.cpp | 11 | ||||
-rw-r--r-- | src/quickcontrols2/ios/qquickiosstyle_p.h | 3 |
3 files changed, 2 insertions, 15 deletions
diff --git a/src/quickcontrols2/doc/src/qtquickcontrols2-ios.qdoc b/src/quickcontrols2/doc/src/qtquickcontrols2-ios.qdoc index e81fb468f8..e193d67e2e 100644 --- a/src/quickcontrols2/doc/src/qtquickcontrols2-ios.qdoc +++ b/src/quickcontrols2/doc/src/qtquickcontrols2-ios.qdoc @@ -51,9 +51,6 @@ \section2 Customization - The iOS style allows customizing the \l {ios-theme-attached-prop}{theme} attribute. - By default it follows the system's theme. - \section3 Palette The iOS style supports palette customization via the \l {Item::}{palette} diff --git a/src/quickcontrols2/ios/qquickiosstyle.cpp b/src/quickcontrols2/ios/qquickiosstyle.cpp index cc629d88e2..f773833f00 100644 --- a/src/quickcontrols2/ios/qquickiosstyle.cpp +++ b/src/quickcontrols2/ios/qquickiosstyle.cpp @@ -21,6 +21,7 @@ QQuickIOSStyle::QQuickIOSStyle(QObject *parent) : QQuickAttachedObject(parent) { init(); + m_theme = qquickios_effective_theme(); } QQuickIOSStyle *QQuickIOSStyle::qmlAttachedProperties(QObject *object) @@ -41,7 +42,6 @@ void QQuickIOSStyle::init() // globalsInitialized = true; // } QQuickAttachedObject::init(); // TODO: lazy init? - setTheme(qquickios_effective_theme()); } QQuickIOSStyle::Theme QQuickIOSStyle::theme() const @@ -49,13 +49,4 @@ QQuickIOSStyle::Theme QQuickIOSStyle::theme() const return m_theme; } -void QQuickIOSStyle::setTheme(Theme theme) -{ - if (m_theme == theme) - return; - m_theme = theme; - - themeChanged(); -} - QT_END_NAMESPACE diff --git a/src/quickcontrols2/ios/qquickiosstyle_p.h b/src/quickcontrols2/ios/qquickiosstyle_p.h index 2134440377..f24b435190 100644 --- a/src/quickcontrols2/ios/qquickiosstyle_p.h +++ b/src/quickcontrols2/ios/qquickiosstyle_p.h @@ -25,7 +25,7 @@ class QQuickIOSStyle : public QQuickAttachedObject { Q_OBJECT Q_PROPERTY(QUrl url READ url CONSTANT) - Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged FINAL) + Q_PROPERTY(Theme theme READ theme NOTIFY themeChanged FINAL) QML_NAMED_ELEMENT(IOS) QML_ATTACHED(QQuickIOSStyle) QML_UNCREATABLE("") @@ -43,7 +43,6 @@ public: static QQuickIOSStyle *qmlAttachedProperties(QObject *object); Theme theme() const; - void setTheme(Theme theme); QUrl url() const; |