diff --git a/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc b/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc index 5fb62c8a687..4659a103cf5 100644 --- a/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc +++ b/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc @@ -121,31 +121,17 @@ \snippet serialization/streambookmarks/mainwindow.cpp 0 - The \c open() function enables the user to open an XBEL file using - QFileDialog. A warning message is displayed along - with the \c fileName and \c errorString if the file cannot be read or - if there is a parse error. + A custom menu, triggered when the user right-clicks on a bookmark, provides + for copying the bookmark as a link or directing a desktop browser to open + the URL it references. This menu is implemented (when relevant features are + enabled) by \c onCustomContextMenuRequested(). \snippet serialization/streambookmarks/mainwindow.cpp 1 - The \c saveAs() function displays a QFileDialog, prompting the user for - a \c fileName. Similar to the - \c open() function, this function also displays a warning message if - the file cannot be written to. - - \snippet serialization/streambookmarks/mainwindow.cpp 2 - - The \c about() function displays a QMessageBox with a brief description - of the example. - - \snippet serialization/streambookmarks/mainwindow.cpp 3 - - In order to implement the \c open(), \c saveAs(), \c exit(), \c about() - and \c aboutQt() functions, we connect them to QAction objects and - add them to the \c fileMenu and \c helpMenu. The connections are as shown - below: - - \snippet serialization/streambookmarks/mainwindow.cpp 5 + In order to implement the \c open(), \c saveAs(), \c exit(), \c about() and + \c aboutQt() functions, \c createMenus() connects them to QAction objects + and adds them to the \c fileMenu and \c helpMenu. The connections are as + shown below: The \c createMenus() function creates the \c fileMenu and \c helpMenu and adds the QAction objects to them in order to create the menu shown @@ -157,6 +143,25 @@ \li \inlineimage helpmenu.png \endtable + \snippet serialization/streambookmarks/mainwindow.cpp 2 + + The \c open() function enables the user to open an XBEL file using + QFileDialog. A warning message is displayed along + with the \c fileName and \c errorString if the file cannot be read or + if there is a parse error. + + \snippet serialization/streambookmarks/mainwindow.cpp 3 + + The \c saveAs() function displays a QFileDialog, prompting the user for + a \c fileName. Similar to the + \c open() function, this function also displays a warning message if + the file cannot be written to. + + \snippet serialization/streambookmarks/mainwindow.cpp 4 + + The \c about() function displays a QMessageBox with a brief description + of the example. + \snippet serialization/streambookmarks/mainwindow.cpp 5 \section1 \c{main()} Function diff --git a/examples/corelib/serialization/streambookmarks/mainwindow.cpp b/examples/corelib/serialization/streambookmarks/mainwindow.cpp index b45b348cf03..e84e8634b10 100644 --- a/examples/corelib/serialization/streambookmarks/mainwindow.cpp +++ b/examples/corelib/serialization/streambookmarks/mainwindow.cpp @@ -45,6 +45,7 @@ MainWindow::MainWindow() } //! [0] +//! [1] #if QT_CONFIG(clipboard) && QT_CONFIG(contextmenu) void MainWindow::onCustomContextMenuRequested(const QPoint &pos) { @@ -62,8 +63,9 @@ void MainWindow::onCustomContextMenuRequested(const QPoint &pos) QDesktopServices::openUrl(QUrl(url)); } #endif // QT_CONFIG(clipboard) && QT_CONFIG(contextmenu) +//! [1] -//! [5] +//! [2] void MainWindow::createMenus() { QMenu *fileMenu = menuBar()->addMenu(tr("&File")); @@ -82,9 +84,9 @@ void MainWindow::createMenus() helpMenu->addAction(tr("&About"), this, &MainWindow::about); helpMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); } -//! [5] +//! [2] -//! [1] +//! [3] void MainWindow::open() { QFileDialog fileDialog(this, tr("Open Bookmark File"), QDir::currentPath()); @@ -115,9 +117,9 @@ void MainWindow::open() } } -//! [1] +//! [3] -//! [2] +//! [4] void MainWindow::saveAs() { QFileDialog fileDialog(this, tr("Save Bookmark File"), QDir::currentPath()); @@ -141,13 +143,13 @@ void MainWindow::saveAs() if (writer.writeFile(&file)) statusBar()->showMessage(tr("File saved"), 2000); } -//! [2] +//! [4] -//! [3] +//! [5] void MainWindow::about() { QMessageBox::about(this, tr("About QXmlStream Bookmarks"), tr("The QXmlStream Bookmarks example demonstrates how to use Qt's " "QXmlStream classes to read and write XML documents.")); } -//! [3] +//! [5]