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)
この関数は非推奨です。新しいコードでの使用は強くお勧めしません。
指定されたitems を、提供されたpainter を使用して、背景の描画後、前景の描画前に描画します。すべての描画はシーン座標系で行われます。各アイテムを描画する前に、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 フラグが最適化フラグとして指定されていない限り、この関数は呼び出されなくなりました。
drawBackground() およびdrawForeground()も参照してください 。
© 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.