aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols2')
-rw-r--r--src/quickcontrols2/ios/CMakeLists.txt6
-rw-r--r--src/quickcontrols2/ios/qquickiostheme.mm82
-rw-r--r--src/quickcontrols2/ios/qquickiostheme_p.h68
-rw-r--r--src/quickcontrols2/ios/qtquickcontrols2iosstyleplugin.cpp5
4 files changed, 160 insertions, 1 deletions
diff --git a/src/quickcontrols2/ios/CMakeLists.txt b/src/quickcontrols2/ios/CMakeLists.txt
index 3815401573..590d95fee7 100644
--- a/src/quickcontrols2/ios/CMakeLists.txt
+++ b/src/quickcontrols2/ios/CMakeLists.txt
@@ -24,6 +24,7 @@ qt_internal_add_qml_module(qtquickcontrols2iosstyleplugin
SOURCES
qtquickcontrols2iosstyleplugin.cpp
qquickiosstyle.cpp qquickiosstyle_p.h
+ qquickiostheme_p.h qquickiostheme.mm
QML_FILES
${qml_files}
DEFINES
@@ -39,6 +40,11 @@ qt_internal_add_qml_module(qtquickcontrols2iosstyleplugin
Qt::QuickControls2ImplPrivate
)
+qt_internal_extend_target(Core CONDITION APPLE AND IOS
+ LIBRARIES
+ ${FWUIKit}
+)
+
file(GLOB resource_glob RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "images/*.png")
foreach(file IN LISTS resource_glob_0)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
diff --git a/src/quickcontrols2/ios/qquickiostheme.mm b/src/quickcontrols2/ios/qquickiostheme.mm
new file mode 100644
index 0000000000..9df29435f7
--- /dev/null
+++ b/src/quickcontrols2/ios/qquickiostheme.mm
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickiostheme_p.h"
+
+#include <QtGui/private/qcoregraphics_p.h>
+
+#ifdef Q_OS_IOS
+#include <UIKit/UIInterface.h>
+#endif
+
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
+
+QT_BEGIN_NAMESPACE
+
+void QQuickIOSTheme::initialize(QQuickTheme *theme)
+{
+ QPalette systemPalette;
+
+ QColor blue;
+ QColor white;
+ QColor disabled;
+#ifdef Q_OS_IOS
+ blue = qt_mac_toQColor(UIColor.systemBlueColor.CGColor);
+ disabled = qt_mac_toQColor(UIColor.tertiarySystemFillColor.CGColor);
+ white = qt_mac_toQColor(UIColor.whiteColor.CGColor);
+#else
+ blue = QColor(qRgba(0, 122, 255, 255));
+ white = QColor(qRgba(255, 255, 255, 255));
+ disabled = QColor(qRgba(118, 118, 128, 31));
+#endif
+ systemPalette.setColor(QPalette::Active, QPalette::Button, blue);
+ systemPalette.setColor(QPalette::Disabled, QPalette::Button, disabled);
+ systemPalette.setColor(QPalette::Active, QPalette::ButtonText, white);
+
+ white.setAlphaF(0.5);
+ systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText, white);
+
+ blue.setAlphaF(0.8);
+ systemPalette.setColor(QPalette::Highlight, blue);
+
+ theme->setPalette(QQuickTheme::System, systemPalette);
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/quickcontrols2/ios/qquickiostheme_p.h b/src/quickcontrols2/ios/qquickiostheme_p.h
new file mode 100644
index 0000000000..ca75c55c20
--- /dev/null
+++ b/src/quickcontrols2/ios/qquickiostheme_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKIOSTHEME_P_H
+#define QQUICKIOSTHEME_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTheme;
+
+class QQuickIOSTheme
+{
+public:
+ static void initialize(QQuickTheme *theme);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKIOSTHEME_P_H
diff --git a/src/quickcontrols2/ios/qtquickcontrols2iosstyleplugin.cpp b/src/quickcontrols2/ios/qtquickcontrols2iosstyleplugin.cpp
index ea95b9a3b8..dda8221556 100644
--- a/src/quickcontrols2/ios/qtquickcontrols2iosstyleplugin.cpp
+++ b/src/quickcontrols2/ios/qtquickcontrols2iosstyleplugin.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qquickiosstyle_p.h"
+#include "qquickiostheme_p.h"
#include <QtCore/qloggingcategory.h>
#include <QtQml/qqml.h>
@@ -59,6 +60,8 @@ public:
QString name() const override;
void initializeTheme(QQuickTheme *theme) override;
+
+ QQuickIOSTheme m_theme;
};
QtQuickControls2IOSStylePlugin::QtQuickControls2IOSStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
@@ -74,7 +77,7 @@ QString QtQuickControls2IOSStylePlugin::name() const
void QtQuickControls2IOSStylePlugin::initializeTheme(QQuickTheme *theme)
{
- Q_UNUSED(theme);
+ m_theme.initialize(theme);
}
QT_END_NAMESPACE