このページでは

画像の挿入

グラフィックコマンドを使用すると、ドキュメントに画像を挿入することができます。画像は、独立した段落として表示することも、本文の中に組み込んで表示することも可能です。

\image

\image コマンドは、最初の引数で指定された画像に展開され、それを中央揃えで独立した段落として表示します。

このコマンドは2つの引数を取ります。1番目の引数は画像ファイルの名前です。2番目の引数は画像の内容を説明するもので、HTMLのalt 属性として使用されます。その内容はスクリーンリーダーによって読み上げられるため、アクセシビリティの観点から、この属性の使用を強く推奨します。 また、Lynx のようなテキストブラウザなど、画像をサポートしていないブラウザでも使用されます。さらに、usealttextastitle変数を設定することで、QDoc に画像のtitle属性を生成させることができます。これは通常、グラフィカルなテキストブラウザにおいて、ユーザーが画像の上にマウスをホバーさせた際にツールチップとして表示されます。

QDocは比較的柔軟ですが、ファイル名と説明文の両方を次のように中括弧で囲むことをお勧めします:

\image {Bandit.png} {A Golden Retriever holding a bag of coffee in its mouth}

この構文が最も明確であり、常に期待通りの結果が得られるはずです。そうでない場合は、ファイル名または説明文の後に必ず改行を入れてください。 説明の引数が複数行にわたる場合は、中括弧が必須となります。説明が二重引用符で囲まれている場合、QDocは出力を生成する前にそれらを削除します。特殊文字は、QDocのHTML出力において、対応するHTMLエンティティコードに置き換えられる場合があります。

/*!
    Qt is a C++ toolkit for cross-platform GUI application development.

    \image {happyguy.jpg} {Happy guy}

    Qt provides single-source portability across Microsoft
    Windows, macOS, Linux, and all major commercial Unix
    variants. It is also available for embedded devices.
*/

関連項目 \inlineimage および \caption。

\inlineimage

\inlineimage コマンドは、引数で指定された画像に展開されます。画像は、テキストの残りの部分と並んでインラインで表示されます。

このコマンドは2つの引数を取ります。1つ目の引数は画像ファイルの名前です。2つ目の引数はオプションで、中括弧 {} 内に画像の簡単な説明を記述するもので、HTMLの画像タグにおける alt="" と同等の役割を果たします。 この説明文は、ツールチップや、Lynx のようなテキストブラウザなど、画像をサポートしていないブラウザで表示される際に使用されます。

\inlineimage コマンドの最も一般的な用途は、リストや表の中での使用です。以下に、リスト内にインライン画像を挿入する例を示します。

/*!
    \list 1
      \li \inlineimage happy.gif {Oh so happy, I am a caption!}
      \li \inlineimage happy.gif Oh so happy, but I'm not a caption.
    \endlist
*/

以下は、表にインライン画像を挿入する例です:

/*!
    \table
    \header
        \li Qt
        \li Qt Creator
    \row
        \li \inlineimage happy.gif {Oh so happy!}
        \li \inlineimage happy.gif Oh so happy!
    \row
        \li \inlineimage happy.gif Oh so happy!
        \li \inlineimage happy.gif {Oh so happy!}
    \endtable
*/

このコマンドは、テキストの中に画像をインラインで挿入するためにも使用できます。

/*!
    \inlineimage training.jpg {Qt Training} The Qt Programming course is
    offered as a five day Open Enrollment Course. The classes are open to
    the public. Although the course is open to anyone who wants to learn,
    attendees should have significant experience in C++ development to
    derive maximum benefit from the course.
*/

関連項目 \image および \caption。

\caption

\caption コマンドは、画像にキャプションを付けます。

このコマンドは、段落の終わりまでのすべてのテキストをキャプションとして扱います。希望通りの効果が出るまで試してみてください。

/*!
  \table 100%
    \row
      \li \image windows-pushbutton.png
         \caption The QPushButton widget provides a command button.
      \li \image windows-toolbutton.png
         \caption The QToolButton class provides a quick-access button to commands
         or options, usually used inside a QToolBar.
   \endtable
*/

関連項目 \image および \inlineimage

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