QQuickTextureFactory Class
QQuickTextureFactory クラスは、QML からカスタムテクスチャを読み込むためのインターフェースを提供します。詳細...
| ヘッダー: | #include <QQuickTextureFactory> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 継承元: | QObject |
パブリック関数
| QQuickTextureFactory() | |
| virtual | ~QQuickTextureFactory() override |
| virtual QSGTexture * | createTexture(QQuickWindow *window) const = 0 |
| virtual QImage | image() const |
| virtual int | textureByteCount() const = 0 |
| virtual QSize | textureSize() const = 0 |
静的パブリックメンバー
| QQuickTextureFactory * | textureFactoryForImage(const QImage &image) |
詳細な説明
テクスチャファクトリの目的は、OpenGL テクスチャに変換可能な画像データのプレースホルダーを提供することです。
画像データの読み込みを担当するスレッドで OpenGL コンテキストが利用可能なことはめったにないため、テクスチャを直接作成することはできません。
メンバ関数のドキュメント
QQuickTextureFactory::QQuickTextureFactory()
テクスチャファクトリを構築します。QQuickTextureFactory は抽象クラスであるため、直接インスタンス化することはできません。
[override virtual noexcept] QQuickTextureFactory::~QQuickTextureFactory()
テクスチャファクトリを破棄します。
[pure virtual] QSGTexture *QQuickTextureFactory::createTexture(QQuickWindow *window) const
この関数は、シーングラフのレンダリングスレッド上で呼び出され、ファクトリからQSGTexture インスタンスを作成します。window は、このテクスチャが作成されるコンテキストを提供します。
QMLは、必要に応じて返されたテクスチャを内部でキャッシュします。この関数の各呼び出しでは、一意のインスタンスを返す必要があります。
この関数が呼び出される時点で、レンダリングに使用される OpenGL コンテキストがバインドされます。
[virtual] QImage QQuickTextureFactory::image() const
このテクスチャの画像バージョンを返します。
返される画像の存続期間は不明であるため、実装ではQImage を直接使用せず、自己完結型のQImage を返す必要があります。
この関数は一般的に使用されるものではなく、処理に時間がかかることが予想されます。
[pure virtual] int QQuickTextureFactory::textureByteCount() const
テクスチャが占有するメモリのバイト数を返します。
[static] QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage &image)
指定されたimage を保持するQQuickTextureFactory を返します。
これは通常、QQuickImageResponse::textureFactory 内のヘルパーとして使用されます。
[pure virtual] QSize QQuickTextureFactory::textureSize() const
テクスチャのサイズを返します。この関数は任意のスレッドから呼び出されるため、OpenGLコンテキストへのバインドに依存してはなりません。
© 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.