Skip to content

Commit 349e1de

Browse files
committed
MapPart: Write 'hidden' XML attribute
Use negated logic to leverage our default behaviour of omitting false values. With this change, files with all parts visible remain unchanged. This fixes undesired changes to symbol sets, examples and test files.
1 parent 91e8024 commit 349e1de

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/core/map_part.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace literal
4747
const QLatin1String objects("objects");
4848
const QLatin1String object("object");
4949
const QLatin1String count("count");
50-
const QLatin1String visibility("visibility");
50+
const QLatin1String hidden("hidden");
5151
}
5252

5353

@@ -96,7 +96,7 @@ void MapPart::save(QXmlStreamWriter& xml) const
9696
{
9797
XmlElementWriter part_element(xml, literal::part);
9898
part_element.writeAttribute(literal::name, name);
99-
part_element.writeAttribute(literal::visibility, visible);
99+
part_element.writeAttribute(literal::hidden, !visible);
100100
{
101101
XmlElementWriter objects_element(xml, literal::objects);
102102
objects_element.writeAttribute(literal::count, objects.size());
@@ -115,8 +115,7 @@ MapPart* MapPart::load(QXmlStreamReader& xml, Map& map, SymbolDictionary& symbol
115115

116116
XmlElementReader part_element(xml);
117117
auto part = new MapPart(part_element.attribute<QString>(literal::name), &map);
118-
if (part_element.hasAttribute(literal::visibility))
119-
part->visible = part_element.attribute<bool>(literal::visibility);
118+
part->visible = !part_element.attribute<bool>(literal::hidden);
120119

121120
while (xml.readNextStartElement())
122121
{

0 commit comments

Comments
 (0)