diff options
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 6 | ||||
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory.cpp | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 989adcc5b0..d531003abe 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -58,6 +58,8 @@ #include <QDebug> +#include <vector> + enum { defaultWindowWidth = 160, defaultWindowHeight = 160 @@ -2068,10 +2070,10 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window) } // Find consecutive registered border areas, starting from the top. - QList<BorderRange> ranges = m_contentBorderAreas.values(); + std::vector<BorderRange> ranges(m_contentBorderAreas.cbegin(), m_contentBorderAreas.cend()); std::sort(ranges.begin(), ranges.end()); int effectiveTopContentBorderThickness = m_topContentBorderThickness; - foreach (BorderRange range, ranges) { + for (BorderRange range : ranges) { // Skip disiabled ranges (typically hidden tool bars) if (!m_enabledContentBorderAreas.value(range.identifier, false)) continue; diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index c044d37575..c535cf5f9e 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -55,6 +55,7 @@ #include <qapplication.h> #include <qdebug.h> +#include <vector> #include <algorithm> QT_BEGIN_NAMESPACE @@ -191,9 +192,11 @@ QByteArray QItemEditorFactory::valuePropertyName(int userType) const QItemEditorFactory::~QItemEditorFactory() { //we make sure we delete all the QItemEditorCreatorBase - //this has to be done only once, hence the QSet - QSet<QItemEditorCreatorBase*> set = creatorMap.values().toSet(); - qDeleteAll(set); + //this has to be done only once, hence the sort-unique idiom + std::vector<QItemEditorCreatorBase*> creators(creatorMap.cbegin(), creatorMap.cend()); + std::sort(creators.begin(), creators.end()); + const auto it = std::unique(creators.begin(), creators.end()); + qDeleteAll(creators.begin(), it); } /*! |