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.