Obsolete Members for QGraphicsScene
クラスQGraphicsScene の以下のメンバーは非推奨です。これらは古いソース・コードの動作を維持するために提供されています。新しいコードでは使用しないことを強くお勧めします。
保護された関数
(deprecated) virtual void | drawItems(QPainter *painter, int numItems, QGraphicsItem *[] items, const QStyleOptionGraphicsItem[] options, QWidget *widget = nullptr) |
メンバ関数のドキュメント
[virtual protected, deprecated]
void QGraphicsScene::drawItems(QPainter *painter, int numItems, QGraphicsItem *[] items, const QStyleOptionGraphicsItem[] options, QWidget *widget = nullptr)
この関数は非推奨である。新しいコードでは使用しないことを強くお勧めします。
背景が描画された後、前景が描画される前に、与えられたpainter を使って、与えられたitems を描画します。すべての描画はシーン座標で行われます。各アイテムを描画する前に、QGraphicsItem::sceneTransform() を使用してペインターを変換する必要があります。
options パラメータは、items の各アイテムのスタイルオプションオブジェクトのリストです。numItems パラメータはitems のアイテム数とoptions のオプション数です。widget パラメータはオプションです。指定する場合は、ペイントされるウィジェットを指す必要があります。
デフォルトの実装では、ペインタ行列を準備し、すべてのアイテムに対してQGraphicsItem::paint() を呼び出します。この関数を再実装すると、シーンの全アイテムのカスタムペインティングが可能になり、各アイテムの描画方法を完全に制御できるようになります。各アイテムがどのように描画されるかを完全に制御できるようになります。場合によっては、これにより描画パフォーマンスが大幅に向上します。
例
void CustomScene::drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget) { for (int i = 0; i < numItems; ++i) { // Draw the item painter->save(); painter->setTransform(items[i]->sceneTransform(), true); items[i]->paint(painter, &options[i], widget); painter->restore(); } }
例: Qt 4.6 以降、QGraphicsView::IndirectPainting フラグが Optimization フラグとして与えられていない限り、この関数は呼び出されなくなりました。
drawBackground() およびdrawForeground()も参照して ください。
© 2025 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.