diff options
| author | Masoud Jami <masoud.jami@qt.io> | 2025-02-28 16:23:08 +0100 |
|---|---|---|
| committer | Masoud Jami <masoud.jami@qt.io> | 2025-07-09 11:10:26 +0000 |
| commit | 12636b09ea4143042cfd9de06fe0fe0bf6fb72b0 (patch) | |
| tree | 4563b24480ef160b19f255b8f3839de4a547c028 /src | |
| parent | 3f6b128d7e4be234858ae5171b5ce7cc76c2af14 (diff) | |
uic: support label attribute in UI files
provide support for label attribute in ui files. The label
is used to categorize ID-based translations on Linguist.
This is a part of a larger change in
qttools (3c0836a55d)
Pick-to: 6.8
Pick-to: 6.9
Pick-to: 6.10
Change-Id: If9f010f84d65daea7d8fc5622f7a1d660de064e6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/uic/ui4.cpp | 7 | ||||
| -rw-r--r-- | src/tools/uic/ui4.h | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index b6a8f4eb4bf..e26d0260682 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -54,6 +54,10 @@ void DomUI::read(QXmlStreamReader &reader) setAttributeIdbasedtr(attribute.value() == u"true"_s); continue; } + if (name == u"label"_s) { + setAttributeLabel(attribute.value().toString()); + continue; + } if (name == u"connectslotsbyname"_s) { setAttributeConnectslotsbyname(attribute.value() == u"true"_s); continue; @@ -192,6 +196,9 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeIdbasedtr()) writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s)); + if (hasAttributeLabel()) + writer.writeAttribute(u"label"_s, attributeLabel()); + if (hasAttributeConnectslotsbyname()) writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s)); diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h index 333f7f4e6ad..a46a42c6b73 100644 --- a/src/tools/uic/ui4.h +++ b/src/tools/uic/ui4.h @@ -143,6 +143,11 @@ public: inline void setAttributeIdbasedtr(bool a) { m_attr_idbasedtr = a; m_has_attr_idbasedtr = true; } inline void clearAttributeIdbasedtr() { m_has_attr_idbasedtr = false; } + inline bool hasAttributeLabel() const { return m_has_attr_label; } + inline QString attributeLabel() const { return m_attr_label; } + inline void setAttributeLabel(const QString &a) { m_attr_label = a; m_has_attr_label = true; } + inline void clearAttributeLabel() { m_attr_label.clear(); } + inline bool hasAttributeConnectslotsbyname() const { return m_has_attr_connectslotsbyname; } inline bool attributeConnectslotsbyname() const { return m_attr_connectslotsbyname; } inline void setAttributeConnectslotsbyname(bool a) { m_attr_connectslotsbyname = a; m_has_attr_connectslotsbyname = true; } @@ -264,6 +269,9 @@ private: bool m_attr_idbasedtr = false; bool m_has_attr_idbasedtr = false; + QString m_attr_label; + bool m_has_attr_label = false; + bool m_attr_connectslotsbyname = false; bool m_has_attr_connectslotsbyname = false; |
