aboutsummaryrefslogtreecommitdiffstats
path: root/src/labs/stylekit/qqstylekitstyleandthemebase_p.h
diff options
context:
space:
mode:
authorDoris Verria <doris.verria@qt.io>2025-11-27 17:53:53 +0100
committerDoris Verria <doris.verria@qt.io>2025-12-01 13:03:28 +0100
commitcaeaa6bdd10d1d5b2bcd3b59f629583905197267 (patch)
treea06bea62a507686de54f428168b858f1509bdb77 /src/labs/stylekit/qqstylekitstyleandthemebase_p.h
parent49f14263cd587282f77b0fac761de74483e52485 (diff)
StyleKit: Add style and theme fontsHEADdev
Add a fonts property to the style that allows you to set fonts per control, similarily to what we do in QQuickTheme. The fonts are propagated from the style to the theme, and from the fallback style to the style. That means that if a font is not set for a theme or style, it will be resolved against its fallback font. Since both the QQStyleKitTheme and QQStyleKitStyle should have a fonts property, introduce a common base class: QQStyleKitThemeProperties that contains the fonts property. Later, the palettes can be moved there as well. Also add a font property to the QQStyleKitReader that is suposed to return the font for the current control being read. Change-Id: I116c1ab9bc426570756476ee409513587c475a0d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/labs/stylekit/qqstylekitstyleandthemebase_p.h')
-rw-r--r--src/labs/stylekit/qqstylekitstyleandthemebase_p.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/labs/stylekit/qqstylekitstyleandthemebase_p.h b/src/labs/stylekit/qqstylekitstyleandthemebase_p.h
new file mode 100644
index 0000000000..c59fde77c8
--- /dev/null
+++ b/src/labs/stylekit/qqstylekitstyleandthemebase_p.h
@@ -0,0 +1,49 @@
+// 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
+
+#ifndef QQSTYLEKITTSTYLEANDTHEMEBASE_P_H
+#define QQSTYLEKITTSTYLEANDTHEMEBASE_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 <QtQml/QtQml>
+#include "qqstylekitcontrols_p.h"
+#include "qqstylekitfont_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQStyleKitStyleAndThemeBase : public QQStyleKitControls
+{
+ Q_OBJECT
+ Q_PROPERTY(QQStyleKitFont *fonts READ fonts NOTIFY fontsChanged FINAL)
+ //TODO: Move palettes property here as well
+ QML_UNCREATABLE("This component is abstract, and cannot be instantiated")
+ QML_NAMED_ELEMENT(ThemeProperties)
+
+public:
+ QQStyleKitStyleAndThemeBase(QObject *parent = nullptr);
+
+ QQStyleKitFont *fonts();
+
+signals:
+ void fontsChanged();
+
+private:
+ Q_DISABLE_COPY(QQStyleKitStyleAndThemeBase)
+
+ QQStyleKitFont m_fonts;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQSTYLEKITTSTYLEANDTHEMEBASE_P_H