diff options
Diffstat (limited to 'src/gui/doc/snippets/textdocument-tables')
-rw-r--r-- | src/gui/doc/snippets/textdocument-tables/mainwindow.cpp | 32 | ||||
-rw-r--r-- | src/gui/doc/snippets/textdocument-tables/mainwindow.h | 6 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp index 7712362d57..ab00f43c2e 100644 --- a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp +++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp @@ -193,3 +193,35 @@ void MainWindow::showTable() tableWidget->show(); } +void MainWindow::processFrame(QTextFrame *) +{ +} + +void MainWindow::processBlock(QTextBlock) +{ +} + +void MainWindow::processTable(QTextTable *table) +{ + QTextFrame *frame = qobject_cast<QTextFrame *>(table); +//! [13] + QTextFrame::iterator it; + for (it = frame->begin(); !(it.atEnd()); ++it) { + + QTextFrame *childFrame = it.currentFrame(); + QTextBlock childBlock = it.currentBlock(); + + if (childFrame) { + QTextTable *childTable = qobject_cast<QTextTable*>(childFrame); + + if (childTable) + processTable(childTable); + else + processFrame(childFrame); + + } else if (childBlock.isValid()) { + processBlock(childBlock); + } + } +//! [13] +} diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.h b/src/gui/doc/snippets/textdocument-tables/mainwindow.h index b0ff5c1b91..37a7cc289d 100644 --- a/src/gui/doc/snippets/textdocument-tables/mainwindow.h +++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.h @@ -53,6 +53,9 @@ #include <QMainWindow> class QTextEdit; +class QTextFrame; +class QTextBlock; +class QTextTable; class MainWindow : public QMainWindow { @@ -67,6 +70,9 @@ public slots: private: bool writeXml(const QString &fileName); + void processFrame(QTextFrame *); + void processBlock(QTextBlock); + void processTable(QTextTable *table); QTextEdit *editor = nullptr; }; |