このページでは

マニフェストファイルの例

QDocは、ドキュメント化されたすべての例に関する情報を含む「example-manifest.xml」ファイルを生成します。これらのファイルは、Qt Creator がウェルカム画面で例のリストを表示し、それぞれのドキュメントへリンクするために使用されます。

マニフェスト XML の構造

マニフェストファイルの構造は以下の通りです:

<?xml version="1.0" encoding="UTF-8"?>
<instructionals module="QtGui">
    <examples>
        <example
            name="Analog Clock Window"
            docUrl="qthelp://org.qt-project.qtgui.502/qtgui/analogclock.html"
            projectPath="gui/analogclock/analogclock.pro"
            imageUrl="qthelp://org.qt-project.qtgui.502/qtgui/images/analogclock-window.png">
            <description><![CDATA[The Analog Clock Window example shows how
                to draw the contents of a custom window.]]></description>
            <tags>analog,clock,window</tags>
            <fileToOpen>gui/analogclock/main.cpp</fileToOpen>
        </example>
        ...
    </examples>
</instructionals>

各<example> 要素には、名前、説明、プロジェクトファイルおよびドキュメントの場所に関する情報に加え、そのサンプルに関連付けられたタグのリストが含まれています。

マニフェストのメタコンテンツ

manifestmeta 設定コマンドを使用することで、マニフェストファイルに追加のメタコンテンツ(つまり、選択したサンプルに対する追加の属性やタグ)を付加することが可能です。

メタコンテンツの活用例の一つは、注目すべきサンプルをいくつか強調表示することです。もう一つは、特定のカテゴリのサンプルに関連するキーワードをタグとして追加することで、検索機能を向上させることです。

メタコンテンツを適用する例は、1つ以上のフィルタを使用して指定します。フィルタとの一致判定は名前に基づいて行われ、各例の名前にはモジュール名とスラッシュがプレフィックスとして付きます。単純なワイルドカード一致がサポートされており、末尾に `* ` を指定することで、1つの文字列で複数の例に一致させることができます。

例:

manifestmeta.filters                = highlighted sql webkit global

manifestmeta.highlighted.names      = "QtGui/Analog Clock Window" \
                                      "QtWidgets/Analog Clock"
manifestmeta.highlighted.attributes = isHighlighted:true

manifestmeta.sql.names              = "QtSql/*"
manifestmeta.sql.tags               = database,sql

manifestmeta.webkit.names           = "QtWebKitExamples/*"
manifestmeta.webkit.tags            = webkit

manifestmeta.global.names           = *
manifestmeta.global.tags            = qt6

上記では、2つの例にisHighlighted 属性が追加されています。属性値が省略された場合、QDocはデフォルトでtrue という文字列を使用します。Qt WebKitおよびQt SQL の例には追加のタグが追加され、また、一致文字列として単に* を使用することで、すべての例に別のタグが適用されます。

© 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.