KD Reports API Documentation 2.2
Loading...
Searching...
No Matches
KDReportsTextDocument.cpp
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Reports library.
4**
5** SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
13
14#include <QDebug>
15
16// #define DEBUG_TABLEBREAKING
17
21
25
27{
28 m_contentDocument.layoutWithTextWidth(w);
29}
30
32{
33 m_contentDocument.setPageSize(size);
34}
35
40
42{
43 return contentDocumentData().document();
44}
45
47{
48 return m_contentDocument.document().defaultFont();
49}
50
52{
53 m_contentDocument.scaleFontsBy(factor);
54}
55
57{
58 m_contentDocument.updateTextValue(id, newValue);
59}
60
61//@cond PRIVATE
63{
64 return m_contentDocument.asHtml();
65}
66//@endcond
67
69{
70#if 0
71 qDebug() << "Dumping document:";
72 QTextCursor cursor( &m_contentDocument );
73 int i = 0;
74 int currentBlock = -1;
75 Q_FOREVER {
76 const int blockNumber = cursor.block().blockNumber(); // needs Qt-4.4
77 if ( blockNumber != currentBlock ) {
78 currentBlock = blockNumber;
79 qDebug() << " block" << currentBlock << "starts at char" << i;
82 qDebug() << " block" << currentBlock << "says: BREAK BEFORE";
84 qDebug() << " block" << currentBlock << "says: BREAK AFTER";
85 }
86 const QChar ch = m_contentDocument.characterAt( i );
87 qDebug() << " char" << i << ch << ch.unicode(); // 8233 == paragraph separator
88
89 if ( cursor.atEnd() ) {
90 qDebug() << " document ends at" << cursor.position();
91 break;
92 }
94 ++i;
95 }
96#endif
97}
98
99//@cond PRIVATE
101{
102 return m_contentDocument.autoTableElements(); // doesn't matter in which one we call it
103}
104
106{
107 m_contentDocument.regenerateAutoTables();
108}
109
111{
112 m_contentDocument.regenerateAutoTableForModel(model);
113}
114//@endcond
QString asHtml() const
QList< KDReports::AutoTableElement * > autoTableElements()
void regenerateAutoTableForModel(QAbstractItemModel *model)
TextDocumentData & contentDocumentData()
void updateTextValue(const QString &id, const QString &newValue)
ushort unicode() const const
QTextBlockFormat blockFormat() const const
int blockNumber() const const
QTextFormat::PageBreakFlags pageBreakPolicy() const const
bool atEnd() const const
QTextBlock block() const const
bool movePosition(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode, int n)
int position() const const
typedef PageBreakFlags

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated on Wed Apr 24 2024 04:08:15 for KD Reports API Documentation by doxygen 1.9.8