diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-16 14:25:21 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-17 16:47:59 +0000 |
commit | bb7bc4a05ef219238839d03259f6da7543377e0a (patch) | |
tree | 38a081eac411b68f3a9d09482112b3fac46fae18 /src/widgets | |
parent | 404b1fd8b351c5e23a283a21a621e35cdd24a6e4 (diff) |
QApplication: replace QList::prepend()s with appends()
Use the new reverse_iterator support in QList to
avoid building a QList with prepend()ing, using
append() instead.
Change-Id: I6b9d9b1a9941cf2e6cc39ad2d9097fdc629c24bc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ab8c251f50..a843fdeda5 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2330,7 +2330,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con if (enter && !sameWindow) { auto *w = enter; do { - enterList.prepend(w); + enterList.append(w); } while (!w->isWindow() && (w = w->parentWidget())); } if (sameWindow) { @@ -2361,7 +2361,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con leaveList.append(w); for (auto *w = enter; w != wenter; w = w->parentWidget()) - enterList.prepend(w); + enterList.append(w); } QEvent leaveEvent(QEvent::Leave); @@ -2383,9 +2383,9 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con const QPoint globalPos = qIsInf(globalPosF.x()) ? QPoint(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX) : globalPosF.toPoint(); - const QPoint windowPos = enterList.front()->window()->mapFromGlobal(globalPos); - for (int i = 0; i < enterList.size(); ++i) { - auto *w = enterList.at(i); + const QPoint windowPos = enterList.back()->window()->mapFromGlobal(globalPos); + for (auto it = enterList.crbegin(), end = enterList.crend(); it != end; ++it) { + auto *w = *it; if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { const QPointF localPos = w->mapFromGlobal(globalPos); QEnterEvent enterEvent(localPos, windowPos, globalPosF); |