diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-07-11 14:23:28 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-12 12:14:43 +0000 |
commit | 6ed8a22dd2756557954dc85052870c0894de06ba (patch) | |
tree | a49597a789e4f3861a6d52efddd7d3bd7701c917 /src/designer/src/lib/shared/qdesigner_propertysheet.cpp | |
parent | 9cfa5da0238016c9732f84a3bf3642375382f77c (diff) |
Eradicate the last Java-style iterators and mark the module free of them
... and of QLinkedList.
The change in QDesignerAbstractPropertySheetFactory is
straight-forward.
The rest are little buggers:
- In macdeployqt, the code iterates inside an if. Weird, but portable.
- In CppCodeParser, it's still somewhat harmless: just a call to
std::remove_if to avoid running into quadratic complexity, even
though the original loop had a good idea of iterating backwards,
saving at least some copies in the process. Need to take care there
that we continue to find the _first_ main.cpp, not the last, so add
a check for mainCpp.isEmpty().
- In QtGradientStopsModel, however, needed to work around the absence
of QMap::rbegin()/rend(), and it shows why they're missing: QMap's
funky op* makes it impossible to just use std::reverse_iterator to
do the heavy lifting. Use the recently-added QKeyValueIterator to
get an approximation. I say 'approximation', because that one lacks
operator->, so we need to use (*it).first, which brings back
memories of Qt 2's iterators...
Change-Id: I051e64b8d36b04ed2e7cf7695d9b797f08efaccb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_propertysheet.cpp')
-rw-r--r-- | src/designer/src/lib/shared/qdesigner_propertysheet.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp index 1293b689c..eafc0de4f 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -1657,16 +1657,16 @@ QObject *QDesignerAbstractPropertySheetFactory::extension(QObject *object, const void QDesignerAbstractPropertySheetFactory::objectDestroyed(QObject *object) { - QMutableMapIterator<QObject*, QObject*> it(m_impl->m_extensions); - while (it.hasNext()) { - it.next(); + for (auto it = m_impl->m_extensions.begin(), end = m_impl->m_extensions.end(); it != end; /*erasing*/) { if (it.key() == object || it.value() == object) { if (it.key() == object) { QObject *ext = it.value(); disconnect(ext, &QObject::destroyed, this, &QDesignerAbstractPropertySheetFactory::objectDestroyed); delete ext; } - it.remove(); + it = m_impl->m_extensions.erase(it); + } else { + ++it; } } } |