QGraphicsScene: don't build a temporary QList just to iterate over it

Iterate over the original list instead.

Change-Id: I7be154c0e19074033df6f6e01f68d21a8904d2ee
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
bb10
Marc Mutz 2015-12-20 21:47:18 +01:00
parent e3e0240c77
commit fc8711dece
1 changed files with 4 additions and 7 deletions

View File

@ -5728,18 +5728,15 @@ void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget)
// Raise
if (panel) {
QList<QGraphicsItem *> siblingWindows;
QGraphicsItem *parent = panel->parentItem();
// Raise ### inefficient for toplevels
foreach (QGraphicsItem *sibling, parent ? parent->childItems() : items()) {
if (sibling != panel && sibling->isWindow())
siblingWindows << sibling;
}
// Find the highest z value.
qreal z = panel->zValue();
for (int i = 0; i < siblingWindows.size(); ++i)
z = qMax(z, siblingWindows.at(i)->zValue());
foreach (QGraphicsItem *sibling, parent ? parent->childItems() : items()) {
if (sibling != panel && sibling->isWindow())
z = qMax(z, sibling->zValue());
}
// This will probably never overflow.
const qreal litt = qreal(0.001);