diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 600d9b536f..cb5c8751cf 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -169,7 +169,7 @@ #include #include #include -#include +#include #include #include #include @@ -413,7 +413,7 @@ void IconTiler::rearrange(QList &widgets, const QRect &domain) const \internal Calculates the accumulated overlap (intersection area) between 'source' and 'rects'. */ -int MinOverlapPlacer::accumulatedOverlap(const QRect &source, const QList &rects) +int MinOverlapPlacer::accumulatedOverlap(const QRect &source, const QVector &rects) { int accOverlap = 0; foreach (const QRect &rect, rects) { @@ -429,7 +429,7 @@ int MinOverlapPlacer::accumulatedOverlap(const QRect &source, const QList Finds among 'source' the rectangle with the minimum accumulated overlap with the rectangles in 'rects'. */ -QRect MinOverlapPlacer::findMinOverlapRect(const QList &source, const QList &rects) +QRect MinOverlapPlacer::findMinOverlapRect(const QVector &source, const QVector &rects) { int minAccOverlap = -1; QRect minAccOverlapRect; @@ -447,8 +447,8 @@ QRect MinOverlapPlacer::findMinOverlapRect(const QList &source, const QLi \internal Gets candidates for the final placement. */ -void MinOverlapPlacer::getCandidatePlacements(const QSize &size, const QList &rects, - const QRect &domain,QList &candidates) +void MinOverlapPlacer::getCandidatePlacements(const QSize &size, const QVector &rects, + const QRect &domain,QVector &candidates) { QSet xset; QSet yset; @@ -476,10 +476,10 @@ void MinOverlapPlacer::getCandidatePlacements(const QSize &size, const QList &source, - QList &result) +void MinOverlapPlacer::findNonInsiders(const QRect &domain, QVector &source, + QVector &result) { - QMutableListIterator it(source); + QMutableVectorIterator it(source); while (it.hasNext()) { const QRect srcRect = it.next(); if (!domain.contains(srcRect)) { @@ -494,8 +494,8 @@ void MinOverlapPlacer::findNonInsiders(const QRect &domain, QList &source Finds all rectangles in 'source' that overlaps 'domain' by the maximum overlap area between 'domain' and any rectangle in 'source'. The result is stored in 'result'. */ -void MinOverlapPlacer::findMaxOverlappers(const QRect &domain, const QList &source, - QList &result) +void MinOverlapPlacer::findMaxOverlappers(const QRect &domain, const QVector &source, + QVector &result) { int maxOverlap = -1; foreach (const QRect &srcRect, source) { @@ -517,16 +517,16 @@ void MinOverlapPlacer::findMaxOverlappers(const QRect &domain, const QList &rects, - QList &source) +QPoint MinOverlapPlacer::findBestPlacement(const QRect &domain, const QVector &rects, + QVector &source) { - QList nonInsiders; + QVector nonInsiders; findNonInsiders(domain, source, nonInsiders); if (!source.empty()) return findMinOverlapRect(source, rects).topLeft(); - QList maxOverlappers; + QVector maxOverlappers; findMaxOverlappers(domain, nonInsiders, maxOverlappers); return findMinOverlapRect(maxOverlappers, rects).topLeft(); } @@ -538,7 +538,7 @@ QPoint MinOverlapPlacer::findBestPlacement(const QRect &domain, const QList &rects, +QPoint MinOverlapPlacer::place(const QSize &size, const QVector &rects, const QRect &domain) const { if (size.isEmpty() || !domain.isValid()) @@ -548,7 +548,7 @@ QPoint MinOverlapPlacer::place(const QSize &size, const QList &rects, return QPoint(); } - QList candidates; + QVector candidates; getCandidatePlacements(size, rects, domain, candidates); return findBestPlacement(domain, rects, candidates); } @@ -882,7 +882,8 @@ void QMdiAreaPrivate::place(Placer *placer, QMdiSubWindow *child) return; } - QList rects; + QVector rects; + rects.reserve(childWindows.size()); QRect parentRect = q->rect(); foreach (QMdiSubWindow *window, childWindows) { if (!sanityCheck(window, "QMdiArea::place") || window == child || !window->isVisibleTo(q) diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h index 90db55438a..7d562e1212 100644 --- a/src/widgets/widgets/qmdiarea_p.h +++ b/src/widgets/widgets/qmdiarea_p.h @@ -59,6 +59,7 @@ #ifndef QT_NO_MDIAREA #include +#include #include #include #include @@ -116,24 +117,24 @@ public: // Places the rectangle defined by 'size' relative to 'rects' and 'domain'. // Returns the position of the resulting rectangle. virtual QPoint place( - const QSize &size, const QList &rects, const QRect &domain) const = 0; + const QSize &size, const QVector &rects, const QRect &domain) const = 0; virtual ~Placer() {} }; class MinOverlapPlacer : public Placer { - QPoint place(const QSize &size, const QList &rects, const QRect &domain) const; - static int accumulatedOverlap(const QRect &source, const QList &rects); - static QRect findMinOverlapRect(const QList &source, const QList &rects); + QPoint place(const QSize &size, const QVector &rects, const QRect &domain) const; + static int accumulatedOverlap(const QRect &source, const QVector &rects); + static QRect findMinOverlapRect(const QVector &source, const QVector &rects); static void getCandidatePlacements( - const QSize &size, const QList &rects, const QRect &domain, - QList &candidates); + const QSize &size, const QVector &rects, const QRect &domain, + QVector &candidates); static QPoint findBestPlacement( - const QRect &domain, const QList &rects, QList &source); + const QRect &domain, const QVector &rects, QVector &source); static void findNonInsiders( - const QRect &domain, QList &source, QList &result); + const QRect &domain, QVector &source, QVector &result); static void findMaxOverlappers( - const QRect &domain, const QList &source, QList &result); + const QRect &domain, const QVector &source, QVector &result); }; } // namespace QMdi