fix: font macro expansion + snaplayout jitter with fillWidth: true

This commit is contained in:
2026-11-07 14:42:22 +01:00
parent 4ac55b0c2e
commit a7767d2a80
6 changed files with 296 additions and 172 deletions
+14 -12
View File
@@ -2,18 +2,16 @@
#include "fontbuilder.hpp"
#include <qfont.h>
#include <qobject.h>
#include <qqmlintegration.h>
#include <qvariantmap.h>
#include "settings/objectnode.hpp"
namespace ZShell::config {
class AppearanceFont;
class FontBuilders;
class FontStyleBase;
class FontSizeNode;
class FontStyleNode;
class IconFontStyle;
class FontBuilders : public QObject {
@@ -69,7 +67,7 @@ class FontStyleBase : public QObject {
public:
explicit FontStyleBase(QObject* parent = nullptr);
virtual void bind(FontStyleNode* cfg);
virtual void bind(settings::ObjectNode* cfg);
void setScale(qreal scale);
[[nodiscard]] QFont large() const;
@@ -83,9 +81,11 @@ class FontStyleBase : public QObject {
virtual void rebuild();
static QFont buildFont(
const FontSizeNode* cfg, const QString& fallbackFamily, qreal scale);
const settings::ObjectNode* cfg,
const QString& fallbackFamily,
qreal scale);
FontStyleNode* m_cfg = nullptr;
settings::ObjectNode* m_cfg = nullptr;
qreal m_scale = 1;
QFont m_large;
QFont m_medium;
@@ -96,7 +96,8 @@ class FontStyle : public FontStyleBase {
Q_OBJECT
QML_ANONYMOUS
Q_PROPERTY(FontBuilders* builders READ builders CONSTANT FINAL)
Q_PROPERTY(
ZShell::config::FontBuilders* builders READ builders CONSTANT FINAL)
public:
explicit FontStyle(QObject* parent = nullptr);
@@ -112,15 +113,16 @@ class IconFontStyle : public FontStyleBase {
QML_ANONYMOUS
Q_PROPERTY(QFont extraLarge READ extraLarge NOTIFY fontsChanged FINAL)
Q_PROPERTY(IconFontBuilders* builders READ builders CONSTANT FINAL)
Q_PROPERTY(
ZShell::config::IconFontBuilders* builders READ builders CONSTANT FINAL)
public:
explicit IconFontStyle(QObject* parent = nullptr);
Q_INVOKABLE FontBuilder size(int pointSize);
Q_INVOKABLE FontBuilder pixelSize(int pixelSize);
Q_INVOKABLE ZShell::config::FontBuilder size(int pointSize);
Q_INVOKABLE ZShell::config::FontBuilder pixelSize(int pixelSize);
void bind(FontStyleNode* cfg) override;
void bind(settings::ObjectNode* cfg) override;
[[nodiscard]] QFont extraLarge() const;
[[nodiscard]] IconFontBuilders* builders() const;