aboutsummaryrefslogtreecommitdiffstats
path: root/src/labs/stylekit/impl/DelegateSingleton.qml
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2025-11-19 15:49:47 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2025-11-27 12:22:49 +0100
commitc056aaa055187af7290d363d5ef02a4948cd8813 (patch)
treed5df750ffefe1d9dbb366177587a9b151d113c78 /src/labs/stylekit/impl/DelegateSingleton.qml
parent8890b4a2d56ebdd51bf550d307f48d60ccf9a632 (diff)
StyleKit: add StyleKit to labs
This patch introduces a new styling API for Controls called StyleKit. StyleKit provides a higher-level, key–value–based approach to styling applications, serving as an alternative to working directly with the lower-level Templates API. The primary goal of StyleKit is to offer a unified API for styling both Controls and Widgets. The current Templates-based approach relies heavily on JavaScript, which makes it unsuitable for use with Widgets. This initial version supports Controls only; support for Widgets will be added in a future update. StyleKit is designed to make it easier for designers and UI developers to: - Focus on visual styling rather than Template logic (such as geometry, delegate positioning, and handle placement). - Allow style properties to propagate, enabling you to factor out common styling into shared control types and override only what differs in the more specific control types. - Style controls independently in each of their states, without needing nested ternary expressions to check state. - Define and apply multiple themes with minimal effort. - Provide different style variations depending on context. For example, styling a Switch differently when it appears inside a ToolBar. [ChangeLog][Qt labs] Introduced new QML module 'StyleKit'. StyleKit provides a flexible styling framework for Qt Quick Controls, enabling developers to define reusable styles and themes using a simple key-value property format. Change-Id: Iae25324486aea7a7b9b2ce52135327ec7e9b6f59 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/labs/stylekit/impl/DelegateSingleton.qml')
-rw-r--r--src/labs/stylekit/impl/DelegateSingleton.qml14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/labs/stylekit/impl/DelegateSingleton.qml b/src/labs/stylekit/impl/DelegateSingleton.qml
new file mode 100644
index 0000000000..c119a5b9b6
--- /dev/null
+++ b/src/labs/stylekit/impl/DelegateSingleton.qml
@@ -0,0 +1,14 @@
+// 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
+
+pragma Singleton
+
+import QtQuick
+import Qt.labs.StyleKit
+import Qt.labs.StyleKit.impl
+
+QtObject {
+ readonly property Component defaultDelegate: StyleKitDelegate {}
+ readonly property Component defaultShadowDelegate: Shadow {}
+}