13 #include <QDomElement>
17 if (str == QLatin1String(
"left"))
19 else if (str == QLatin1String(
"right"))
20 return Qt::AlignRight;
21 else if (str == QLatin1String(
"hcenter"))
22 return Qt::AlignHCenter;
24 qWarning(
"Unexpected alignment flag in KDReports::Report::stringToAlignment(): %s", qPrintable(str));
30 if (type == QLatin1String(
"pagenumber"))
32 else if (type == QLatin1String(
"pagecount"))
34 else if (type == QLatin1String(
"textdate"))
36 else if (type == QLatin1String(
"isodate"))
38 else if (type == QLatin1String(
"localedate"))
40 else if (type == QLatin1String(
"texttime"))
42 else if (type == QLatin1String(
"isotime"))
44 else if (type == QLatin1String(
"localetime"))
46 qWarning(
"Unexpected variable type: %s", qPrintable(type));
53 const QString name = element.attribute(QLatin1String(attributeName));
54 if (!name.isEmpty()) {
63 if (element.hasAttribute(QStringLiteral(
"background"))) {
64 const QString name = element.attribute(QStringLiteral(
"background"));
66 }
else if (element.hasAttribute(QStringLiteral(
"bgred")) && element.hasAttribute(QStringLiteral(
"bggreen")) && element.hasAttribute(QStringLiteral(
"bgblue"))) {
71 red = element.attribute(QStringLiteral(
"bgred")).toInt(&ok);
73 green = element.attribute(QStringLiteral(
"bggreen")).toInt(&ok);
75 blue = element.attribute(QStringLiteral(
"bgblue")).toInt(&ok);
89 if (xmlAttr.isEmpty())
91 KDReports::HeaderLocations loc;
92 const QStringList tokens = xmlAttr.toLower().split(QLatin1Char(
','));
93 for (
const QString &s : tokens) {
94 QString token = s.trimmed();
95 if (token == QLatin1String(
"first"))
97 else if (token == QLatin1String(
"last"))
99 else if (token == QLatin1String(
"odd"))
101 else if (token == QLatin1String(
"even"))
103 else if (token == QLatin1String(
"all"))
106 qWarning() <<
"Found unexpected token in header location attribute:" << token;
static KDReports::VariableType stringToVariableType(const QString &type)
static Qt::AlignmentFlag stringToAlignment(const QString &str)
static QColor readBackground(const QDomElement &element)
static QColor readColor(const QDomElement &element, const char *attributeName)
static KDReports::HeaderLocations parseHeaderLocation(const QString &xmlAttr)
@ ISODate
names but unlocalized order of names and numbers
@ TextTime
Current time in text format like "13:42:59".
@ LocaleDate
Current date in locale-dependent format, deprecated in favour of SystemLocaleShortDate or SystemLocal...
@ LocaleTime
Current time in locale-dependent format.
@ ISOTime
Current time in ISO 8601 format like "13:42:59".
@ AllPages
All pages (except first and last if FirstPage or LastPage have their own headers)
@ FirstPage
The first page of the report.
@ EvenPages
The even pages of the report: 2, 4, 6 etc.
@ LastPage
The last page of the report.
@ OddPages
The odd pages of the report: 1 (unless FirstPage has its own header), 3, 5, 7 etc.