Added text alignment to conditional formats

Combo box for selecting the desired text alignment for a conditional
format.

The default alignment in the browser has been adjusted for numbers, which
are now aligned to the right as in spreadsheets.

Project file format updated.

See issues #1976 and #1815.
This commit is contained in:
mgrojo
2019-09-21 23:28:35 +02:00
parent 1ec502ae9b
commit c27002c301
8 changed files with 92 additions and 8 deletions

View File

@@ -2252,10 +2252,16 @@ static void loadBrowseDataTableSettings(BrowseDataTableSettings& settings, QXmlS
else
Settings::getValue("databrowser", "font").toString();
CondFormat::Alignment align;
if (xml.attributes().hasAttribute("align"))
align = static_cast<CondFormat::Alignment>(xml.attributes().value("align").toInt());
else
align = CondFormat::AlignLeft;
settings.condFormats[index].emplace_back(xml.attributes().value("condition").toString(),
QColor(xml.attributes().value("foreground").toString()),
QColor(xml.attributes().value("background").toString()),
font, settings.encoding);
font, align, settings.encoding);
xml.skipCurrentElement();
}
}
@@ -2594,6 +2600,7 @@ static void saveBrowseDataTableSettings(const BrowseDataTableSettings& object, Q
xml.writeAttribute("background", format.backgroundColor().name());
xml.writeAttribute("foreground", format.foregroundColor().name());
xml.writeAttribute("font", format.font().toString());
xml.writeAttribute("align", QString().setNum(format.alignment()));
xml.writeEndElement();
}
xml.writeEndElement();