diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-10-22 14:10:44 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-10-22 14:10:44 (GMT) |
commit | 2231e4f03c621459e1c261b2ed224a49877d2ddf (patch) | |
tree | 93abd9fbf65a69c052b53170c0628d6dd9345034 /src/tools/uic/ui4.cpp | |
parent | 03c1445ed4be734a82cea59d107c51a4be43c5f4 (diff) | |
download | Qt-2231e4f03c621459e1c261b2ed224a49877d2ddf.zip Qt-2231e4f03c621459e1c261b2ed224a49877d2ddf.tar.gz Qt-2231e4f03c621459e1c261b2ed224a49877d2ddf.tar.bz2 |
Designer: Support alignment in box and grid layouts.
Extend ui-format by alignment-attribute for QLayoutItem,
handle it in uic and formbuilder.
Support in Designer by context menu.
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Task-number: QTBUG-3120
Diffstat (limited to 'src/tools/uic/ui4.cpp')
-rw-r--r-- | src/tools/uic/ui4.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index 1988696..e094eaf 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -3673,6 +3673,7 @@ void DomLayoutItem::clear(bool clear_all) m_attr_rowSpan = 0; m_has_attr_colSpan = false; m_attr_colSpan = 0; + m_has_attr_alignment = false; } m_kind = Unknown; @@ -3694,6 +3695,7 @@ DomLayoutItem::DomLayoutItem() m_attr_rowSpan = 0; m_has_attr_colSpan = false; m_attr_colSpan = 0; + m_has_attr_alignment = false; m_widget = 0; m_layout = 0; m_spacer = 0; @@ -3727,6 +3729,10 @@ void DomLayoutItem::read(QXmlStreamReader &reader) setAttributeColSpan(attribute.value().toString().toInt()); continue; } + if (name == QLatin1String("alignment")) { + setAttributeAlignment(attribute.value().toString()); + continue; + } reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString()); } @@ -3779,6 +3785,8 @@ void DomLayoutItem::read(const QDomElement &node) setAttributeRowSpan(node.attribute(QLatin1String("rowspan")).toInt()); if (node.hasAttribute(QLatin1String("colspan"))) setAttributeColSpan(node.attribute(QLatin1String("colspan")).toInt()); + if (node.hasAttribute(QLatin1String("alignment"))) + setAttributeAlignment(node.attribute(QLatin1String("alignment"))); for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) { if (!n.isElement()) @@ -3828,6 +3836,9 @@ void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) cons if (hasAttributeColSpan()) writer.writeAttribute(QLatin1String("colspan"), QString::number(attributeColSpan())); + if (hasAttributeAlignment()) + writer.writeAttribute(QLatin1String("alignment"), attributeAlignment()); + switch (kind()) { case Widget: { DomWidget* v = elementWidget(); |