QGraphicsScene::render: fix int/qsizetype mismatch
Also suppresses the warning that we may be trying to allocate -1 items in call to new[]. Task-number: QTBUG-105388 Task-number: QTBUG-105471 Change-Id: Ie4bb662dcb274440ab8bfffd17096d3606354647 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 70d040fa1abb5c195643a9e2c5d8681ba1ea54c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9b5361fa7f
commit
11d7070654
@ -1816,8 +1816,8 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect
|
||||
// in reverse order).
|
||||
QList<QGraphicsItem *> itemList = items(sourceRect, Qt::IntersectsItemBoundingRect);
|
||||
QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()];
|
||||
const int numItems = itemList.size();
|
||||
for (int i = 0; i < numItems; ++i)
|
||||
const qsizetype numItems = itemList.size();
|
||||
for (qsizetype i = 0; i < numItems; ++i)
|
||||
itemArray[numItems - i - 1] = itemList.at(i);
|
||||
itemList.clear();
|
||||
|
||||
@ -1834,7 +1834,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect
|
||||
|
||||
// Generate the style options
|
||||
QStyleOptionGraphicsItem *styleOptionArray = new QStyleOptionGraphicsItem[numItems];
|
||||
for (int i = 0; i < numItems; ++i)
|
||||
for (qsizetype i = 0; i < numItems; ++i)
|
||||
itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect());
|
||||
|
||||
// Render the scene.
|
||||
|
Loading…
x
Reference in New Issue
Block a user