ドキュメントのナビゲーション
ナビゲーションコマンドは、ドキュメント内のページを意味のある順序で結びつけるためのものです。以下に、ナビゲーションコマンドの典型的な使用例を示す一連の QDoc コメントを示します。
例
/*!
\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
*/\startpage コマンドは、作成者が複数ページのドキュメントの最初のページとして指定したページへのリンクを作成します。
このリンクは生成されたHTMLソースコードに含まれますが、ドキュメントの表示上は何も変化しません:
<head>
...
<link rel="start" href="basicqt.html" />
...
</head>コマンド
\previouspage
\previouspage コマンドは、現在のページをシーケンス内の前のページにリンクします。このコマンドには2つの引数があり、それぞれ中括弧で囲まれています。1つ目はリンク先(前のページのタイトル)、2つ目はリンクテキストです。ページのタイトルがリンクテキストと同じ場合は、2つ目の引数を省略できます。
このコマンドは、単独で1行に記述する必要があります。
\nextpage
\nextpage コマンドは、現在のページをシーケンス内の次のページにリンクします。このコマンドは、 \previouspage コマンドと同様の構文および引数の規則に従います。
\startpage
\startpage コマンドは、一連のページの最初のページを指定します。このコマンドは単独で行に記述する必要があり、唯一の引数として最初の文書のタイトルを指定します。
QDocは、開始ページへのリンクを生成して生成されたHTMLファイルに含めますが、これはドキュメントの表示には影響しません。生成されるリンクの種類によって、ブラウザや検索エンジンに対し、著者がどの文書をコレクションの起点と見なしているかが示されます。
\toc
\toc および\endtoc コマンドは、そのコマンドが含まれるトピックのサブトピック(ページ)のリストを指定します。各トピックの目次(TOC)エントリに基づいて、ドキュメントプロジェクト全体に対する目次(TOC)の階層構造が生成されます。
\toc..\endtoc ブロック内では、 \tocentry コマンドを使用して、タイトルごとにサブトピックを指定します。 \l (link) コマンドと同様に、\tocentry コマンドは、生成される目次エントリでユーザーに表示されるタイトルとして、オプションの 2 番目の引数を受け取ります。
/*!
\page index.html
\title Qt
...
\toc
\tocentry {Introduction to Qt} {Introduction}
\tocentry {What's new in Qt} {What's new}
\tocentry {Getting started}
\endtoc
*/\tocコマンドはネストできません。ただし、各サブトピックは独自の目次エントリを指定できます。1つのトピックで使用できる\toc コマンドは1つだけです。
QDocは、生成された目次構造をXML形式で<project>_toc.xmlファイルに書き込みます。
注: ルートトピック(インデックスまたはランディングページ)は 、プロジェクト設定でnavigation.landingpage またはnavigation.homepage のいずれかを指定する必要があります。詳細については navigation を参照してください。
\toc コマンドは、Qt 6.11 のリリースに伴い QDoc に導入されました。
関連項目 \tocentry。
\tocentry
目次の項目としてサブトピック(ページ)を指定します。\toc および\endtoc コマンドのペア内でのみ使用できます。
\tocentry コマンドは、Qt 6.11 から QDoc に導入されました。
関連項目 \toc.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.