From 3722c293c18dcb2f8941e8c8ad60f70f40786cec Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 9 Jun 2023 14:04:38 +0000 Subject: [PATCH] Doc: Fix documentation issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Qt Widgets Application example was moved to manual tests, and no longer contains the snippet identifiers. Fix \snippet and \quotefile commands to quote similar code snippets from other examples or snippet files. Fix also the following documentation warnings: * No such parameter 'parsingMode' in QUrl::fromEncoded() * Missing image: rsslisting.cpp Change-Id: Ibc989e83abc49837db08628facaf8e5f72b2f123 Reviewed-by: Tor Arne Vestbø (cherry picked from commit 17ddf2a6a52bab5d406bea560591961a7527929b) Reviewed-by: Qt Cherry-pick Bot --- .../serialization/rsslisting/doc/src/rsslisting.qdoc | 2 +- examples/widgets/mainwindows/mdi/mainwindow.cpp | 2 ++ examples/widgets/richtext/textedit/textedit.cpp | 2 ++ src/corelib/doc/snippets/resource-system/application.pro | 4 ++-- src/corelib/doc/src/resource-system.qdoc | 4 ++-- src/corelib/io/qurl.cpp | 2 +- src/gui/kernel/qaction.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 7 +++---- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/corelib/serialization/rsslisting/doc/src/rsslisting.qdoc b/examples/corelib/serialization/rsslisting/doc/src/rsslisting.qdoc index b86fab1e1b0..260d26811ce 100644 --- a/examples/corelib/serialization/rsslisting/doc/src/rsslisting.qdoc +++ b/examples/corelib/serialization/rsslisting/doc/src/rsslisting.qdoc @@ -24,7 +24,7 @@ the parsed content may start in one chunk of data but not be completed until a later chunk, requiring the parser to retain state between calls. - \image rsslisting.cpp + \image rsslisting.png The main program is fairly minimal. It simply instantiates a \l QApplication and the \c RSSListing widget, shows the latter and hands over control to the diff --git a/examples/widgets/mainwindows/mdi/mainwindow.cpp b/examples/widgets/mainwindows/mdi/mainwindow.cpp index 250ee786fbf..89998f31603 100644 --- a/examples/widgets/mainwindows/mdi/mainwindow.cpp +++ b/examples/widgets/mainwindows/mdi/mainwindow.cpp @@ -279,6 +279,7 @@ void MainWindow::createActions() fileMenu->addAction(newAct); fileToolBar->addAction(newAct); +//! [qaction setup] const QIcon openIcon = QIcon::fromTheme("document-open", QIcon(":/images/open.png")); QAction *openAct = new QAction(openIcon, tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); @@ -286,6 +287,7 @@ void MainWindow::createActions() connect(openAct, &QAction::triggered, this, &MainWindow::open); fileMenu->addAction(openAct); fileToolBar->addAction(openAct); +//! [qaction setup] const QIcon saveIcon = QIcon::fromTheme("document-save", QIcon(":/images/save.png")); saveAct = new QAction(saveIcon, tr("&Save"), this); diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index fd2d4a8a162..51a8f54bd54 100644 --- a/examples/widgets/richtext/textedit/textedit.cpp +++ b/examples/widgets/richtext/textedit/textedit.cpp @@ -116,6 +116,7 @@ TextEdit::TextEdit(QWidget *parent) #endif } +//! [closeevent] void TextEdit::closeEvent(QCloseEvent *e) { if (maybeSave()) @@ -123,6 +124,7 @@ void TextEdit::closeEvent(QCloseEvent *e) else e->ignore(); } +//! [closeevent] void TextEdit::setupFileActions() { diff --git a/src/corelib/doc/snippets/resource-system/application.pro b/src/corelib/doc/snippets/resource-system/application.pro index 4b1f1d76353..42c66eba4cf 100644 --- a/src/corelib/doc/snippets/resource-system/application.pro +++ b/src/corelib/doc/snippets/resource-system/application.pro @@ -2,9 +2,9 @@ TEMPLATE = app QT += qml widgets -#! [0] +#! [0] #! [qrc] RESOURCES = application.qrc -#! [0] +#! [0] #! [qrc] #! [1] resources.files = \ diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 67f0c840ed2..27993a4d3d2 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -52,7 +52,7 @@ Here's an example \c .qrc file: - \quotefile resource-system/mainwindow.qrc + \quotefile resource-system/application.qrc Each \c element in the XML identifies a file in the application's source tree. The path is resolved relative to the directory containing @@ -102,7 +102,7 @@ variable. If you add a \c .qrc file path to the variable, the listed resource files will be embedded into the generated library or executable: - \snippet resource-system/mainwindow.pro qrc + \snippet resource-system/application.pro qrc This creates a resource of several \c{.png} files, that are addressable like this: \c{":/res/titlebarLeft.png"}. diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index da22a356052..95f688ac286 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2976,7 +2976,7 @@ QByteArray QUrl::toEncoded(FormattingOptions options) const Parses \a input and returns the corresponding QUrl. \a input is assumed to be in encoded form, containing only ASCII characters. - Parses the URL using \a parsingMode. See setUrl() for more information on + Parses the URL using \a mode. See setUrl() for more information on this parameter. QUrl::DecodedMode is not permitted in this context. \sa toEncoded(), setUrl() diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 0f389789a13..dccdb1ac3e0 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -173,7 +173,7 @@ QObject *QActionPrivate::menu() const menu and toolbar, then connected to the slot which will perform the action. For example: - \snippet ../widgets/mainwindows/application/mainwindow.cpp 19 + \snippet ../widgets/mainwindows/mdi/mainwindow.cpp qaction setup Actions are added to widgets using QWidget::addAction() or QGraphicsWidget::addAction(). Note that an action must be added to a diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 3f5e966bda1..2a116e84904 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9862,13 +9862,12 @@ void QWidget::actionEvent(QActionEvent *) Main window applications typically use reimplementations of this function to check whether the user's work has been saved and ask for permission before closing. - For example, the \l{Qt Widgets - Application Example} uses a helper function to + For example, the \l{Text Edit} example uses a helper function to determine whether or not to close the window: - \snippet mainwindows/application/mainwindow.cpp 3 - \snippet mainwindows/application/mainwindow.cpp 4 + \snippet richtext/textedit/textedit.cpp closeevent - \sa event(), hide(), close(), QCloseEvent, {Qt Widgets - Application Example} + \sa event(), hide(), close(), QCloseEvent */ void QWidget::closeEvent(QCloseEvent *event)