diff options
Diffstat (limited to 'src/gui/doc/snippets/textdocument-frames/mainwindow.cpp')
-rw-r--r-- | src/gui/doc/snippets/textdocument-frames/mainwindow.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp b/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp index 96b84fe61a..2608fb9f00 100644 --- a/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp +++ b/src/gui/doc/snippets/textdocument-frames/mainwindow.cpp @@ -65,6 +65,12 @@ MainWindow::MainWindow() menuBar()->addMenu(fileMenu); editor = new QTextEdit; +//! [rootframe] + QTextDocument *editorDocument = editor->document(); + QTextFrame *root = editorDocument->rootFrame(); +//! [rootframe] + processFrame(root); + QTextCursor cursor(editor->textCursor()); cursor.movePosition(QTextCursor::Start); @@ -151,3 +157,23 @@ void MainWindow::saveFile() } } +void MainWindow::processBlock(QTextBlock) +{ +} + +void MainWindow::processFrame(QTextFrame *frame) +{ +//! [4] + QTextFrame::iterator it; + for (it = frame->begin(); !(it.atEnd()); ++it) { + + QTextFrame *childFrame = it.currentFrame(); + QTextBlock childBlock = it.currentBlock(); + + if (childFrame) + processFrame(childFrame); + else if (childBlock.isValid()) + processBlock(childBlock); + } +//! [4] +} |