diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-11-18 13:58:40 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-11-19 12:28:45 +0100 |
commit | 5669351bdf45acc8ca2e1334b9f53ebd2a541b6b (patch) | |
tree | 1d0b9a343f9de030a2b2e5401504cabace7176e5 /src/gui/doc | |
parent | 3c525f2a21d0e010f0a33128d032cbef8553d3cc (diff) |
Doc: Fix documentation warnings for Qt GUI
- Remove obsolete dependencies and references.
- Restore previously deleted snippet code referenced in
richtext.qdoc.
- Add widgets snippets path to exampledirs; some classes
were moved from QtWidgets to QtGUI and related \snippet
commands were broken.
- Mark internal functions under QNativeInterface::Private
as \internal.
Task-number: QTBUG-86295
Change-Id: I9c165c860c7191dac65972d702698a1745bff77f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/gui/doc')
-rw-r--r-- | src/gui/doc/qtgui.qdocconf | 3 | ||||
-rw-r--r-- | src/gui/doc/snippets/textdocument-frames/mainwindow.cpp | 26 | ||||
-rw-r--r-- | src/gui/doc/snippets/textdocument-frames/mainwindow.h | 4 | ||||
-rw-r--r-- | src/gui/doc/snippets/textdocument-tables/mainwindow.cpp | 32 | ||||
-rw-r--r-- | src/gui/doc/snippets/textdocument-tables/mainwindow.h | 6 | ||||
-rw-r--r-- | src/gui/doc/src/richtext.qdoc | 9 |
6 files changed, 72 insertions, 8 deletions
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index cbde0ce92c..2ec3470d4c 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -36,8 +36,6 @@ tagfile = ../../../doc/qtgui/qtgui.tags depends += \ qtcore \ qtimageformats \ - qtmacextras \ - qtmultimedia \ qtnetwork \ qtopengl \ qtprintsupport \ @@ -59,6 +57,7 @@ sourcedirs += .. \ exampledirs += ../../../examples/gui \ ../../../examples/vulkan \ + ../../widgets/doc/snippets \ snippets imagedirs += images \ 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] +} diff --git a/src/gui/doc/snippets/textdocument-frames/mainwindow.h b/src/gui/doc/snippets/textdocument-frames/mainwindow.h index 941138d0e9..40fa8e41e0 100644 --- a/src/gui/doc/snippets/textdocument-frames/mainwindow.h +++ b/src/gui/doc/snippets/textdocument-frames/mainwindow.h @@ -54,6 +54,8 @@ #include <QMainWindow> class QTextEdit; +class QTextFrame; +class QTextBlock; class MainWindow : public QMainWindow { @@ -67,6 +69,8 @@ public slots: private: bool writeXml(const QString &fileName); + void processBlock(QTextBlock); + void processFrame(QTextFrame *frame); QTextEdit *editor = nullptr; }; 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; }; diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index a963124849..4114067c66 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -179,8 +179,7 @@ We obtain the root frame in the following manner: - \snippet textdocument-frames/xmlwriter.h 0 - \snippet textdocument-frames/xmlwriter.cpp 0 + \snippet textdocument-frames/mainwindow.cpp rootframe When navigating the document structure, it is useful to begin at the root frame because it provides access to the entire document structure. @@ -266,8 +265,7 @@ child frames. We can inspect the contents of a frame by using a QTextFrame::iterator to traverse the frame's child elements: - \snippet textdocument-frames/xmlwriter.cpp 1 - \snippet textdocument-frames/xmlwriter.cpp 2 + \snippet textdocument-frames/mainwindow.cpp 4 Note that the iterator selects both frames and blocks, so it is necessary to check which it is referring to. This allows us to navigate the document @@ -291,8 +289,7 @@ document, we can test whether it represents a table, and deal with it in a different way: - \snippet textdocument-tables/xmlwriter.cpp 0 - \snippet textdocument-tables/xmlwriter.cpp 1 + \snippet textdocument-tables/mainwindow.cpp 13 The cells within an existing table can be examined by iterating through the rows and columns. |