26 : d(new HeaderPrivate(report))
28 d->m_textDocument.contentDocument().setDefaultFont(report->d->m_layout->defaultFont());
31 KDReports::Header::~Header()
37 d->m_builder.addInlineElementPublic(element);
43 d->m_builder.addBlockElementPublic(element, horizontalAlignment);
49 return d->m_textDocument;
60 return QString::number(pageNumber + 1);
68 return QLocale::system().toString(QDate::currentDate(), QLocale::ShortFormat);
70 return QLocale::system().toString(QDate::currentDate(), QLocale::LongFormat);
73 return QLocale().toString(QDate::currentDate(), QLocale::ShortFormat);
75 return QLocale().toString(QDate::currentDate(), QLocale::LongFormat);
81 return QLocale().toString(QTime::currentTime(), QLocale::ShortFormat);
83 qWarning() <<
"Program error, variable" << type <<
"not implemented";
91 QTextCursor c(&textDoc);
93 c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
94 QTextCharFormat charFormat = c.charFormat();
98 c.setCharFormat(charFormat);
110 d->m_builder.addVariablePublic(variable);
115 d->m_builder.addVerticalSpacingPublic(space);
118 void KDReports::Header::preparePaintingPage(
int pageNumber)
121 QTextCursor c(&d->m_textDocument.contentDocument());
123 c.movePosition(QTextCursor::NextCharacter);
125 QTextCharFormat format = c.charFormat();
128 c.movePosition(QTextCursor::PreviousCharacter);
133 const int startPos = c.position();
134 c.setPosition(c.position() + oldLength, QTextCursor::KeepAnchor);
138 setVariableMarker(d->m_textDocument.contentDocument(), startPos, variableType, value.length());
140 }
while (!c.atEnd());
146 f.setStyleStrategy(QFont::ForceOutline);
147 d->m_textDocument.contentDocument().setDefaultFont(f);
148 d->m_builder.setDefaultFont(f);
153 return d->m_textDocument.contentDocument().defaultFont();
158 d->m_builder.setTabPositions(tabs);
163 return d->m_builder.currentPosition();
int numberOfPages() const
QString variableValue(int pageNumber, KDReports::Report *report, VariableType type)
@ ISODate
names but unlocalized order of names and numbers
@ TextTime
Current time in text format like "13:42:59".
@ SystemLocaleShortDate
Current date formatted according to the system locale, short format, see Qt::SystemLocaleShortDate.
@ LocaleDate
Current date in locale-dependent format, deprecated in favour of SystemLocaleShortDate or SystemLocal...
@ LocaleTime
Current time in locale-dependent format.
@ DefaultLocaleShortDate
Current date formatted according to the application locale, short format, see Qt::DefaultLocaleShortD...
@ ISOTime
Current time in ISO 8601 format like "13:42:59".
@ DefaultLocaleLongDate
Current date formatted according to the application locale, long format, see Qt::DefaultLocaleLongDat...
@ SystemLocaleLongDate
Current date formatted according to the system locale, long format, see Qt::SystemLocaleLongDate.
static const int ResizableImageProperty
void setVariableMarker(QTextDocument &textDoc, int pos, KDReports::VariableType variableType, int valueLength)
void cleanupVariableProperties(QTextCharFormat &charFormat)