文档导航

The navigation commands are for linking the pages of a document in a meaningful sequence. Below is a sequence of QDoc comments that shows a typical use of the navigation commands.

范例

 /*!
     \page basicqt.html
     \nextpage Getting Started
     \indexpage Index
     \startpage Basic Qt
     \title Basic Qt
     The Qt toolkit is a C++ class library and a set of tools for
     building multiplatform GUI programs using a "write once,
     compile anywhere approach".
     Table of contents:
     \list
     \li \l {Getting Started}
     \li \l {Creating Dialogs}
     \li \l {Creating Main Windows}
     \endlist
 */
 /*!
    \page gettingstarted.html
    \previouspage Basic Qt
    \nextpage Creating Dialogs
    \indexpage Index
    \startpage Basic Qt
    \title Getting Started
    This chapter shows how to combine basic C++ with the
    functionality provided by Qt to create a few small graphical
    interface (GUI) applications.
*/
/ *!
    \page creatingdialogs.html
    \previouspage Getting Started
    \indexpage Index
    \startpage Basic Qt
    \title Creating Dialogs
    This chapter will teach you how to create dialog boxes using Qt.
*/
/*!
    \page index.html
    \indexpage Index
    \startpage Basic Qt
    \title Index
    \list
        \li \l {Basic Qt}
        \li \l {Creating Dialogs}
        \li \l {Getting Started}
    \endlist
*/
					

QDoc renders the "Getting Started" page in creatingdialogs.html :

[Previous: Basic Qt ] [ 内容 ] [Next: Creating Dialogs ]

快速入门

This chapter shows how to combine basic C++ with the functionality provided by Qt to create a few small graphical interface (GUI) applications.

[Previous: Basic Qt ] [ 内容 ] [Next: Creating Dialogs ]

The \startpage command creates a link to the page the author wants as the first page of a multipage document.

The link is included in the generated HTML source code but has no visual effect on the documentation:

<head>
    ...
    <link rel="start" href="basicqt.html" />
    ...
</head>
					

命令

\previouspage

The \previouspage command links the current page to the previous page in a sequence. The command has two arguments, each enclosed by curly braces: the first is the link target (the title of the previous page), the second is the link text. If the page's title is equivalent to the link text, the second argument can be omitted.

The command must stand alone on its own line.

\nextpage

The \nextpage command links the current page to the next page in a sequence. The command follows the same syntax and argument convention as the \previouspage 命令。

\startpage

The \startpage command specifies the first page of a sequence of pages. The command must stand alone on its own line, and its unique argument is the title of the first document.

QDoc will generate a link to the start page and include it in the generated HTML file, but this has no visual effect on the documentation. The generated link type tells browsers and search engines which document is considered by the author to be the starting point of the collection.