diff options
| author | Doris Verria <[email protected]> | 2025-12-05 15:14:28 +0100 |
|---|---|---|
| committer | Doris Verria <[email protected]> | 2025-12-05 16:34:10 +0100 |
| commit | 687bbe86573f06eb4b247d925fd66db751501f05 (patch) | |
| tree | eb0c49c956b070285b4dffd504e17686ea4813fe /src | |
| parent | c210717f1de5a4e3fa36285491024917dbe38378 (diff) | |
StyleKit: Add ApplicationWindow
Change-Id: I9cc429c5a5e229983cb68648df239260903a0af4
Reviewed-by: Richard Moe Gustavsen <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/labs/stylekit/ApplicationWindow.qml | 27 | ||||
| -rw-r--r-- | src/labs/stylekit/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/labs/stylekit/impl/FallbackStyle.qml | 6 | ||||
| -rw-r--r-- | src/labs/stylekit/qqstylekitcontrols.cpp | 2 | ||||
| -rw-r--r-- | src/labs/stylekit/qqstylekitcontrols_p.h | 3 | ||||
| -rw-r--r-- | src/labs/stylekit/qqstylekitpropertyresolver.cpp | 4 | ||||
| -rw-r--r-- | src/labs/stylekit/qqstylekitreader_p.h | 1 | ||||
| -rw-r--r-- | src/labs/stylekit/qqstylekitstyle.cpp | 5 |
8 files changed, 44 insertions, 5 deletions
diff --git a/src/labs/stylekit/ApplicationWindow.qml b/src/labs/stylekit/ApplicationWindow.qml new file mode 100644 index 0000000000..d55cf8dea5 --- /dev/null +++ b/src/labs/stylekit/ApplicationWindow.qml @@ -0,0 +1,27 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default + +import QtQuick +import QtQuick.Controls.impl +import QtQuick.Templates as T +import Qt.labs.StyleKit +import Qt.labs.StyleKit.impl + +T.ApplicationWindow { + id: control + + leftPadding: styleReader.leftPadding + topPadding: styleReader.topPadding + rightPadding: styleReader.rightPadding + bottomPadding: styleReader.bottomPadding + + StyleKitControl.controlType: styleReader.type + StyleKitReader { + id: styleReader + type: StyleKitReader.ApplicationWindow + palette: control.palette + } + + color: styleReader.background.color +} diff --git a/src/labs/stylekit/CMakeLists.txt b/src/labs/stylekit/CMakeLists.txt index ef374d90e1..e9ea19b459 100644 --- a/src/labs/stylekit/CMakeLists.txt +++ b/src/labs/stylekit/CMakeLists.txt @@ -32,6 +32,7 @@ qt_internal_add_qml_module(QtQuickStyleKit QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QML_FILES + ApplicationWindow.qml Button.qml CheckBox.qml ComboBox.qml diff --git a/src/labs/stylekit/impl/FallbackStyle.qml b/src/labs/stylekit/impl/FallbackStyle.qml index dc24e0a949..10893f88a4 100644 --- a/src/labs/stylekit/impl/FallbackStyle.qml +++ b/src/labs/stylekit/impl/FallbackStyle.qml @@ -14,6 +14,10 @@ BaseStyle { readonly property real indicatorSize: 24 + applicationWindow { + background.color: style.palette.window + } + control { spacing: 5 padding: 5 @@ -76,7 +80,7 @@ BaseStyle { implicitWidth: 200 implicitHeight: 200 border.width: 1 - border.color: "black" + border.color: style.palette.dark color: style.palette.base } } diff --git a/src/labs/stylekit/qqstylekitcontrols.cpp b/src/labs/stylekit/qqstylekitcontrols.cpp index 160f51e37a..31f0cc51e0 100644 --- a/src/labs/stylekit/qqstylekitcontrols.cpp +++ b/src/labs/stylekit/qqstylekitcontrols.cpp @@ -64,7 +64,9 @@ void QQStyleKitControls::set_ ## NAME(QQStyleKitControl *control) \ m_controls.insert(TYPE, control); \ } + IMPLEMENT_ACCESSORS(abstractButton, QQStyleKitReader::ControlType::AbstractButton) +IMPLEMENT_ACCESSORS(applicationWindow, QQStyleKitReader::ControlType::ApplicationWindow) IMPLEMENT_ACCESSORS(control, QQStyleKitReader::ControlType::Control) IMPLEMENT_ACCESSORS(button, QQStyleKitReader::ControlType::Button) IMPLEMENT_ACCESSORS(flatButton, QQStyleKitReader::ControlType::FlatButton) diff --git a/src/labs/stylekit/qqstylekitcontrols_p.h b/src/labs/stylekit/qqstylekitcontrols_p.h index 49b274f118..8f93a4cd9d 100644 --- a/src/labs/stylekit/qqstylekitcontrols_p.h +++ b/src/labs/stylekit/qqstylekitcontrols_p.h @@ -32,6 +32,7 @@ class QQStyleKitControls : public QObject, public QQmlParserStatus Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QQStyleKitControl *abstractButton READ abstractButton WRITE set_abstractButton NOTIFY abstractButtonChanged FINAL) + Q_PROPERTY(QQStyleKitControl *applicationWindow READ applicationWindow WRITE set_applicationWindow NOTIFY applicationWindowChanged FINAL) Q_PROPERTY(QQStyleKitControl *control READ control WRITE set_control NOTIFY controlChanged FINAL) Q_PROPERTY(QQStyleKitControl *button READ button WRITE set_button NOTIFY buttonChanged FINAL) Q_PROPERTY(QQStyleKitControl *checkBox READ checkBox WRITE set_checkBox NOTIFY checkBoxChanged FINAL) @@ -73,6 +74,7 @@ public: QQStyleKitControl *NAME() const; \ void set_ ## NAME(QQStyleKitControl *control); + IMPLEMENT_ACCESSORS(applicationWindow) IMPLEMENT_ACCESSORS(abstractButton) IMPLEMENT_ACCESSORS(control) IMPLEMENT_ACCESSORS(button) @@ -114,6 +116,7 @@ public: signals: void dataChanged(); + void applicationWindowChanged(); void abstractButtonChanged(); void controlChanged(); void buttonChanged(); diff --git a/src/labs/stylekit/qqstylekitpropertyresolver.cpp b/src/labs/stylekit/qqstylekitpropertyresolver.cpp index 6569be295d..06c41baf7b 100644 --- a/src/labs/stylekit/qqstylekitpropertyresolver.cpp +++ b/src/labs/stylekit/qqstylekitpropertyresolver.cpp @@ -37,6 +37,10 @@ const QList<QQStyleKitExtendedControlType> QQStyleKitPropertyResolver::baseTypes * Control. */ switch (exactType) { + case QQStyleKitReader::ApplicationWindow: { + static QList<QQStyleKitExtendedControlType> t = + { QQStyleKitReader::ApplicationWindow }; + return t; } case QQStyleKitReader::Button: case QQStyleKitReader::ToolButton: case QQStyleKitReader::TabButton: diff --git a/src/labs/stylekit/qqstylekitreader_p.h b/src/labs/stylekit/qqstylekitreader_p.h index 7163579706..ad20ce2e34 100644 --- a/src/labs/stylekit/qqstylekitreader_p.h +++ b/src/labs/stylekit/qqstylekitreader_p.h @@ -51,6 +51,7 @@ public: Unspecified = 100000, Control, AbstractButton, + ApplicationWindow, Button, CheckBox, ComboBox, diff --git a/src/labs/stylekit/qqstylekitstyle.cpp b/src/labs/stylekit/qqstylekitstyle.cpp index ae540ebd6c..0fc88c2e72 100644 --- a/src/labs/stylekit/qqstylekitstyle.cpp +++ b/src/labs/stylekit/qqstylekitstyle.cpp @@ -262,13 +262,10 @@ QQStyleKitStyle* QQStyleKitStyle::current() QFont QQStyleKitStyle::fontForReader(QQStyleKitReader *reader) const { switch (reader->type()) { - case QQStyleKitReader::ControlType::Control: - return m_theme->fonts()->system(); case QQStyleKitReader::ControlType::AbstractButton: case QQStyleKitReader::ControlType::Button: - case QQStyleKitReader::ControlType::FlatButton: { + case QQStyleKitReader::ControlType::FlatButton: return m_theme->fonts()->button(); - } case QQStyleKitReader::ControlType::CheckBox: return m_theme->fonts()->checkBox(); case QQStyleKitReader::ControlType::ComboBox: |
