summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorAnton Kudryavtsev <antkudr@mail.ru>2017-03-19 14:19:22 +0300
committerAnton Kudryavtsev <antkudr@mail.ru>2017-03-28 11:15:33 +0000
commitbae0c4c11a6dda52e5d1e9d6d7d0de3ebd47642b (patch)
tree4cf8fb5706002c5569d15546184ff8f5a236c8c7 /src/plugins/platforms/cocoa/qcocoawindow.mm
parent81b5aa792f84747962cb05e0cf11708e4466bf30 (diff)
Avoid expensive QHash::values() calls
qcocoawindow.mm: we can replace QHash::values() with std::vector since CoW is needless here and std::vector is more cache-friendly. Also replace foreach with range-based for. qitemeditorfactory.cpp: QHash::values() is used as auxiliary container to create QSet. Replace it with std::vector since CoW is needless here and apply sort-unique idiom to remove duplicates. Also avoid needless allocations. Change-Id: If34c7016977ceb7fab68e9298bf2e1944af79139 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
1 files changed, 4 insertions, 2 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;