aboutsummaryrefslogtreecommitdiffstats
path: root/src/labs/stylekit/qqstylekitreader_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/qqstylekitreader_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/qqstylekitreader_p.h')
-rw-r--r--src/labs/stylekit/qqstylekitreader_p.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/labs/stylekit/qqstylekitreader_p.h b/src/labs/stylekit/qqstylekitreader_p.h
index 860c12855f..33257141a9 100644
--- a/src/labs/stylekit/qqstylekitreader_p.h
+++ b/src/labs/stylekit/qqstylekitreader_p.h
@@ -21,6 +21,7 @@
#include "qqstylekitglobal_p.h"
#include "qqstylekitcontrolproperties_p.h"
+#include "qqstylekitfont_p.h"
#include "qqstylekitstorage_p.h"
QT_BEGIN_NAMESPACE
@@ -40,6 +41,7 @@ class QQStyleKitReader : public QQStyleKitControlProperties
Q_PROPERTY(bool pressed READ pressed WRITE setPressed NOTIFY pressedChanged FINAL)
Q_PROPERTY(bool vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
Q_PROPERTY(bool highlighted READ highlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
+ Q_PROPERTY(QFont font READ font NOTIFY fontChanged FINAL)
Q_PROPERTY(QQuickPalette *palette READ palette WRITE setPalette NOTIFY paletteChanged FINAL)
Q_PROPERTY(QQStyleKitControlProperties *global READ global CONSTANT FINAL)
@@ -111,6 +113,9 @@ public:
bool highlighted() const;
void setHighlighted(bool highlighted);
+ QFont font() const;
+ void setFont(const QFont &font);
+
QQStyleKitControlProperties *global() const;
QVariant readStyleProperty(PropertyStorageId key) const;
@@ -123,6 +128,8 @@ public:
static bool transitionEnabled();
static void resetAll();
+ void updateFontFromTheme();
+
static QList<QQStyleKitReader *> s_allReaders;
signals:
@@ -137,6 +144,7 @@ signals:
void paletteChanged();
void verticalChanged();
void highlightedChanged();
+ void fontChanged();
private:
void updateControl();
@@ -163,6 +171,7 @@ private:
bool m_effectiveVariationsDirty: 1;
QQuickPalette m_palette;
+ QFont m_font;
mutable QQStyleKitPropertyStorage m_storage;
AlternateState m_alternateState = AlternateState::Alternate1;
QQSK::State m_state = QQSK::StateFlag::NoState;