fix: font macro expansion + snaplayout jitter with fillWidth: true
This commit is contained in:
@@ -134,25 +134,11 @@ struct FontConfig {
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class FontSizeNode : public settings::ObjectNode {
|
||||
CONFIG_NODE(FontSizeNode, settings::ObjectNode)
|
||||
};
|
||||
|
||||
class FontStyleNode : public settings::ObjectNode {
|
||||
CONFIG_NODE(FontStyleNode, settings::ObjectNode)
|
||||
|
||||
public:
|
||||
virtual FontSizeNode* largeNode() const = 0;
|
||||
virtual FontSizeNode* mediumNode() const = 0;
|
||||
virtual FontSizeNode* smallNode() const = 0;
|
||||
virtual FontSizeNode* extraLargeNode() const { return nullptr; }
|
||||
};
|
||||
|
||||
#define ARG(...) __VA_ARGS__
|
||||
#define FONT(...) ZShell::config::detail::FontConfig __VA_ARGS__
|
||||
#define FONT_CONFIG(Style, Size, props) \
|
||||
class FontConfig##Style##Size : public FontSizeNode { \
|
||||
CONFIG_NODE(FontConfig##Style##Size, FontSizeNode) \
|
||||
class FontConfig##Style##Size : public settings::ObjectNode { \
|
||||
CONFIG_NODE(FontConfig##Style##Size, settings::ObjectNode) \
|
||||
\
|
||||
CONFIG_PROPERTY( \
|
||||
QString, \
|
||||
@@ -168,18 +154,13 @@ class FontStyleNode : public settings::ObjectNode {
|
||||
FONT_CONFIG(Style, Medium, ARG(medium_)) \
|
||||
FONT_CONFIG(Style, Small, ARG(small_)) \
|
||||
\
|
||||
class FontStyle##Style : public FontStyleNode { \
|
||||
CONFIG_NODE(FontStyle##Style, FontStyleNode) \
|
||||
class FontStyle##Style : public settings::ObjectNode { \
|
||||
CONFIG_NODE(FontStyle##Style, settings::ObjectNode) \
|
||||
\
|
||||
CONFIG_PROPERTY(QString, family, family_) \
|
||||
CONFIG_SUBOBJECT(FontConfig##Style##Large, large) \
|
||||
CONFIG_SUBOBJECT(FontConfig##Style##Medium, medium) \
|
||||
CONFIG_SUBOBJECT(FontConfig##Style##Small, small) \
|
||||
\
|
||||
public: \
|
||||
FontSizeNode* largeNode() const override { return m_large; } \
|
||||
FontSizeNode* mediumNode() const override { return m_medium; } \
|
||||
FontSizeNode* smallNode() const override { return m_small; } \
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
@@ -215,20 +196,14 @@ FONT_CONFIG(Icon, Large, FONT({.size = static_cast<int>(32 / 1.33)}))
|
||||
FONT_CONFIG(Icon, Medium, FONT({.size = static_cast<int>(24 / 1.33)}))
|
||||
FONT_CONFIG(Icon, Small, FONT({.size = static_cast<int>(20 / 1.33)}))
|
||||
|
||||
class FontStyleIcon : public FontStyleNode {
|
||||
CONFIG_NODE(FontStyleIcon, FontStyleNode)
|
||||
class FontStyleIcon : public settings::ObjectNode {
|
||||
CONFIG_NODE(FontStyleIcon, settings::ObjectNode)
|
||||
|
||||
CONFIG_PROPERTY(QString, family, u"Material Symbols Rounded"_s)
|
||||
CONFIG_SUBOBJECT(FontConfigIconExtraLarge, extraLarge)
|
||||
CONFIG_SUBOBJECT(FontConfigIconLarge, large)
|
||||
CONFIG_SUBOBJECT(FontConfigIconMedium, medium)
|
||||
CONFIG_SUBOBJECT(FontConfigIconSmall, small)
|
||||
|
||||
public:
|
||||
FontSizeNode* extraLargeNode() const override { return m_extraLarge; }
|
||||
FontSizeNode* largeNode() const override { return m_large; }
|
||||
FontSizeNode* mediumNode() const override { return m_medium; }
|
||||
FontSizeNode* smallNode() const override { return m_small; }
|
||||
};
|
||||
|
||||
#undef ARG
|
||||
|
||||
Reference in New Issue
Block a user