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부터 이 함수는 Optimization 플래그로 QGraphicsView::IndirectPainting 플래그를 지정하지 않으면 더 이상 호출되지 않습니다.

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.