summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-05-25 12:33:29 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-05-30 10:11:13 +0000
commit942ca87c2e26ffd9de8fa62a0bb78ae1eddcda58 (patch)
tree309731fc16de540be1cfbbfd60103e4008716848
parente4d07944602e8a7c720ed277342114c645c64493 (diff)
Qt Designer: Use auto for iterators
Remove some typedefs. Change-Id: Ib7c45fcb35491215a2798a53051ea044f1ae3707 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit bc40da956425f2025d6066ab52d5fd62233ba40a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp5
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.cpp2
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.cpp16
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp6
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp4
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.cpp28
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.h3
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp53
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.h16
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp18
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.h3
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp33
-rw-r--r--src/designer/src/components/signalsloteditor/connectdialog.cpp10
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp5
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp6
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.cpp2
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.h3
-rw-r--r--src/designer/src/designer/mainwindow.cpp2
-rw-r--r--src/designer/src/designer/qdesigner_workbench.cpp4
-rw-r--r--src/designer/src/lib/extension/default_extensionfactory.cpp2
-rw-r--r--src/designer/src/lib/extension/default_extensionfactory.h3
-rw-r--r--src/designer/src/lib/extension/qextensionmanager.cpp6
-rw-r--r--src/designer/src/lib/extension/qextensionmanager.h3
-rw-r--r--src/designer/src/lib/shared/connectionedit.cpp4
-rw-r--r--src/designer/src/lib/shared/grid.cpp2
-rw-r--r--src/designer/src/lib/shared/layout.cpp2
-rw-r--r--src/designer/src/lib/shared/metadatabase.cpp3
-rw-r--r--src/designer/src/lib/shared/metadatabase_p.h3
-rw-r--r--src/designer/src/lib/shared/morphmenu.cpp5
-rw-r--r--src/designer/src/lib/shared/newformwidget.cpp2
-rw-r--r--src/designer/src/lib/shared/orderdialog.cpp3
-rw-r--r--src/designer/src/lib/shared/orderdialog_p.h3
-rw-r--r--src/designer/src/lib/shared/pluginmanager.cpp13
-rw-r--r--src/designer/src/lib/shared/previewmanager.cpp8
-rw-r--r--src/designer/src/lib/shared/qdesigner_command.cpp7
-rw-r--r--src/designer/src/lib/shared/qdesigner_command_p.h3
-rw-r--r--src/designer/src/lib/shared/qdesigner_dnditem.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet.cpp9
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotion.cpp12
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp2
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor.cpp2
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp19
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils.cpp2
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils_p.h2
-rw-r--r--src/designer/src/lib/shared/qlayout_widget.cpp6
-rw-r--r--src/designer/src/lib/shared/qtresourcemodel.cpp29
-rw-r--r--src/designer/src/lib/shared/qtresourceview.cpp7
-rw-r--r--src/designer/src/lib/shared/widgetdatabase.cpp33
-rw-r--r--src/designer/src/lib/shared/widgetfactory.cpp8
-rw-r--r--src/designer/src/lib/shared/widgetfactory_p.h6
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp13
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra.cpp14
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra_p.h3
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp2
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d.cpp4
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopscontroller.cpp13
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopsmodel.cpp12
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopswidget.cpp15
-rw-r--r--src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp3
-rw-r--r--src/shared/qtpropertybrowser/qteditorfactory.cpp45
-rw-r--r--src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp9
-rw-r--r--src/shared/qtpropertybrowser/qtpropertybrowser.cpp3
-rw-r--r--src/shared/qttoolbardialog/qttoolbardialog.cpp5
63 files changed, 228 insertions, 345 deletions
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp
index a364e8083..0e2c0f52a 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -1116,8 +1116,7 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
if (!buttonGroupChildren.isEmpty())
insertNames(metaDataBase, buttonGroupChildren.constBegin(), buttonGroupChildren.constEnd(), w, existingNames);
- const StringSet::const_iterator enEnd = existingNames.constEnd();
- if (existingNames.constFind(s) == enEnd)
+ if (!existingNames.contains(s))
return true;
if (!changeIt)
return false;
@@ -1144,7 +1143,7 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
for (num++ ; ;num++) {
s.truncate(idx);
s += QString::number(num);
- if (existingNames.constFind(s) == enEnd)
+ if (!existingNames.contains(s))
break;
}
return false;
diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp
index e81f8c67d..e24a6638a 100644
--- a/src/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/src/designer/src/components/formeditor/formwindowmanager.cpp
@@ -768,7 +768,7 @@ QWidgetList FormWindowManager::layoutsToBeBroken() const
for (QWidget *wToBeInserted : unsortedLayouts) {
if (!orderedLayoutList.contains(wToBeInserted)) {
// try to find first child, use as insertion position, else append
- const QWidgetList::iterator firstChildPos = findFirstChildOf(orderedLayoutList.begin(), orderedLayoutList.end(), wToBeInserted);
+ const auto firstChildPos = findFirstChildOf(orderedLayoutList.begin(), orderedLayoutList.end(), wToBeInserted);
if (firstChildPos == orderedLayoutList.end()) {
orderedLayoutList.push_back(wToBeInserted);
} else {
diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.cpp b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
index f750b087f..cb047380e 100644
--- a/src/designer/src/components/formeditor/itemview_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
@@ -24,8 +24,6 @@ struct Property {
int m_id{-1};
};
-typedef QMap<int, Property> FakePropertyMap;
-
struct ItemViewPropertySheetPrivate {
ItemViewPropertySheetPrivate(QDesignerFormEditorInterface *core,
QHeaderView *horizontalHeader,
@@ -35,7 +33,7 @@ struct ItemViewPropertySheetPrivate {
inline QString fakePropertyName(const QString &prefix, const QString &realName);
// Maps index of fake property to index of real property in respective sheet
- FakePropertyMap m_propertyIdMap;
+ QMap<int, Property> m_propertyIdMap;
// Maps name of fake property to name of real property
QHash<QString, QString> m_propertyNameMap;
@@ -165,7 +163,7 @@ QHash<QString,QString> ItemViewPropertySheet::propertyNameMap() const
QVariant ItemViewPropertySheet::property(int index) const
{
- const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ const auto it = d->m_propertyIdMap.constFind(index);
if (it != d->m_propertyIdMap.constEnd())
return it.value().m_sheet->property(it.value().m_id);
return QDesignerPropertySheet::property(index);
@@ -173,7 +171,7 @@ QVariant ItemViewPropertySheet::property(int index) const
void ItemViewPropertySheet::setProperty(int index, const QVariant &value)
{
- const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ const auto it = d->m_propertyIdMap.find(index);
if (it != d->m_propertyIdMap.end()) {
it.value().m_sheet->setProperty(it.value().m_id, value);
} else {
@@ -183,7 +181,7 @@ void ItemViewPropertySheet::setProperty(int index, const QVariant &value)
void ItemViewPropertySheet::setChanged(int index, bool changed)
{
- const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ const auto it = d->m_propertyIdMap.find(index);
if (it != d->m_propertyIdMap.end()) {
it.value().m_sheet->setChanged(it.value().m_id, changed);
} else {
@@ -193,7 +191,7 @@ void ItemViewPropertySheet::setChanged(int index, bool changed)
bool ItemViewPropertySheet::isChanged(int index) const
{
- const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ const auto it = d->m_propertyIdMap.constFind(index);
if (it != d->m_propertyIdMap.constEnd())
return it.value().m_sheet->isChanged(it.value().m_id);
return QDesignerPropertySheet::isChanged(index);
@@ -201,7 +199,7 @@ bool ItemViewPropertySheet::isChanged(int index) const
bool ItemViewPropertySheet::hasReset(int index) const
{
- const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ const auto it = d->m_propertyIdMap.constFind(index);
if (it != d->m_propertyIdMap.constEnd())
return it.value().m_sheet->hasReset(it.value().m_id);
return QDesignerPropertySheet::hasReset(index);
@@ -209,7 +207,7 @@ bool ItemViewPropertySheet::hasReset(int index) const
bool ItemViewPropertySheet::reset(int index)
{
- const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ const auto it = d->m_propertyIdMap.find(index);
if (it != d->m_propertyIdMap.end()) {
QDesignerPropertySheetExtension *headerSheet = it.value().m_sheet;
const int headerIndex = it.value().m_id;
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index 64b227d0c..b6e61606d 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -427,8 +427,7 @@ QDesignerResource::QDesignerResource(FormWindow *formWindow) :
m_internal_to_qt.insert(u"QDesignerDockWidget"_s, u"QDockWidget"_s);
// invert
- QHash<QString, QString>::const_iterator cend = m_internal_to_qt.constEnd();
- for (QHash<QString, QString>::const_iterator it = m_internal_to_qt.constBegin();it != cend; ++it ) {
+ for (auto it = m_internal_to_qt.cbegin(), cend = m_internal_to_qt.cend(); it != cend; ++it ) {
if (it.value() != designerWidget && it.value() != layoutWidget)
m_qt_to_internal.insert(it.value(), it.key());
@@ -496,8 +495,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
const QVariantMap designerFormData = m_formWindow->formData();
if (!designerFormData.isEmpty()) {
DomPropertyList domPropertyList;
- const QVariantMap::const_iterator cend = designerFormData.constEnd();
- for (QVariantMap::const_iterator it = designerFormData.constBegin(); it != cend; ++it) {
+ for (auto it = designerFormData.cbegin(), cend = designerFormData.cend(); it != cend; ++it) {
if (DomProperty *prop = variantToDomProperty(this, widget->metaObject(), it.key(), it.value()))
domPropertyList += prop;
}
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel.cpp b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
index db4747287..a3d468600 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -383,8 +383,8 @@ namespace qdesigner_internal {
if (newModel.isEmpty())
return;
- const ObjectModel::const_iterator mcend = newModel.constEnd();
- ObjectModel::const_iterator it = newModel.constBegin();
+ const auto mcend = newModel.cend();
+ auto it = newModel.cbegin();
// Set up root element
StandardItemList rootRow = createModelRow(it->object());
it->setItems(rootRow, m_icons);
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
index a814fa80e..38b4b6a9d 100644
--- a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
@@ -147,24 +147,24 @@ void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtPr
bool BrushPropertyManager::uninitializeProperty(QtProperty *property)
{
- const PropertyBrushMap::iterator brit = m_brushValues.find(property); // Brushes
+ const auto brit = m_brushValues.find(property); // Brushes
if (brit == m_brushValues.end())
return false;
m_brushValues.erase(brit);
// style
- PropertyToPropertyMap::iterator subit = m_brushPropertyToStyleSubProperty.find(property);
- if (subit != m_brushPropertyToStyleSubProperty.end()) {
- QtProperty *styleProp = subit.value();
+ const auto styleIt = m_brushPropertyToStyleSubProperty.find(property);
+ if (styleIt != m_brushPropertyToStyleSubProperty.end()) {
+ QtProperty *styleProp = styleIt .value();
m_brushStyleSubPropertyToProperty.remove(styleProp);
- m_brushPropertyToStyleSubProperty.erase(subit);
+ m_brushPropertyToStyleSubProperty.erase(styleIt );
delete styleProp;
}
// color
- subit = m_brushPropertyToColorSubProperty.find(property);
- if (subit != m_brushPropertyToColorSubProperty.end()) {
- QtProperty *colorProp = subit.value();
+ const auto colorIt = m_brushPropertyToColorSubProperty.find(property);
+ if (colorIt != m_brushPropertyToColorSubProperty.end()) {
+ QtProperty *colorProp = colorIt .value();
m_brushColorSubPropertyToProperty.remove(colorProp);
- m_brushPropertyToColorSubProperty.erase(subit);
+ m_brushPropertyToColorSubProperty.erase(colorIt );
delete colorProp;
}
return true;
@@ -172,7 +172,7 @@ bool BrushPropertyManager::uninitializeProperty(QtProperty *property)
void BrushPropertyManager::slotPropertyDestroyed(QtProperty *property)
{
- PropertyToPropertyMap::iterator subit = m_brushStyleSubPropertyToProperty.find(property);
+ auto subit = m_brushStyleSubPropertyToProperty.find(property);
if (subit != m_brushStyleSubPropertyToProperty.end()) {
m_brushPropertyToStyleSubProperty[subit.value()] = 0;
m_brushStyleSubPropertyToProperty.erase(subit);
@@ -221,7 +221,7 @@ int BrushPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *pro
{
if (value.metaType().id() != QMetaType::QBrush)
return DesignerPropertyManager::NoMatch;
- const PropertyBrushMap::iterator brit = m_brushValues.find(property);
+ const auto brit = m_brushValues.find(property);
if (brit == m_brushValues.end())
return DesignerPropertyManager::NoMatch;
@@ -239,7 +239,7 @@ int BrushPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *pro
bool BrushPropertyManager::valueText(const QtProperty *property, QString *text) const
{
- const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
+ const auto brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
if (brit == m_brushValues.constEnd())
return false;
const QBrush &brush = brit.value();
@@ -251,7 +251,7 @@ bool BrushPropertyManager::valueText(const QtProperty *property, QString *text)
bool BrushPropertyManager::valueIcon(const QtProperty *property, QIcon *icon) const
{
- const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
+ const auto brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
if (brit == m_brushValues.constEnd())
return false;
*icon = QtPropertyBrowserUtils::brushValueIcon(brit.value());
@@ -260,7 +260,7 @@ bool BrushPropertyManager::valueIcon(const QtProperty *property, QIcon *icon) co
bool BrushPropertyManager::value(const QtProperty *property, QVariant *v) const
{
- const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
+ const auto brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
if (brit == m_brushValues.constEnd())
return false;
v->setValue(brit.value());
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.h b/src/designer/src/components/propertyeditor/brushpropertymanager.h
index a39062fbf..b8aa895cf 100644
--- a/src/designer/src/components/propertyeditor/brushpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/brushpropertymanager.h
@@ -55,8 +55,7 @@ private:
PropertyToPropertyMap m_brushStyleSubPropertyToProperty;
PropertyToPropertyMap m_brushColorSubPropertyToProperty;
- typedef QMap<QtProperty *, QBrush> PropertyBrushMap;
- PropertyBrushMap m_brushValues;
+ QMap<QtProperty *, QBrush> m_brushValues;
};
}
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
index b7dba1e5d..a346db3bd 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -1080,7 +1080,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
} else if (QtProperty *iProperty = m_iconSubPropertyToProperty.value(property, 0)) {
QtVariantProperty *iconProperty = variantProperty(iProperty);
PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(iconProperty->value());
- QMap<QtProperty *, QPair<QIcon::Mode, QIcon::State> >::ConstIterator itState = m_iconSubPropertyToState.constFind(property);
+ const auto itState = m_iconSubPropertyToState.constFind(property);
if (itState != m_iconSubPropertyToState.constEnd()) {
QPair<QIcon::Mode, QIcon::State> pair = m_iconSubPropertyToState.value(property);
icon.setPixmap(pair.first, pair.second, qvariant_cast<PropertySheetPixmapValue>(value));
@@ -1102,7 +1102,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
void DesignerPropertyManager::slotPropertyDestroyed(QtProperty *property)
{
if (QtProperty *flagProperty = m_flagToProperty.value(property, 0)) {
- PropertyToPropertyListMap::iterator it = m_propertyToFlags.find(flagProperty);
+ const auto it = m_propertyToFlags.find(flagProperty);
auto &propertyList = it.value();
propertyList.replace(propertyList.indexOf(property), 0);
m_flagToProperty.remove(property);
@@ -1119,8 +1119,7 @@ void DesignerPropertyManager::slotPropertyDestroyed(QtProperty *property)
if (m_propertyToTheme.value(iconProperty) == property) {
m_propertyToTheme.remove(iconProperty);
} else {
- QMap<QtProperty *, QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> >::iterator it =
- m_propertyToIconSubProperties.find(iconProperty);
+ const auto it = m_propertyToIconSubProperties.find(iconProperty);
QPair<QIcon::Mode, QIcon::State> state = m_iconSubPropertyToState.value(property);
QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> &propertyList = it.value();
propertyList.remove(state);
@@ -1189,13 +1188,13 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
QtProperty *prop = const_cast<QtProperty *>(property);
if (attribute == QLatin1String(resettableAttributeC)) {
- const PropertyBoolMap::const_iterator it = m_resetMap.constFind(prop);
+ const auto it = m_resetMap.constFind(prop);
if (it != m_resetMap.constEnd())
return it.value();
}
if (attribute == QLatin1String(flagsAttributeC)) {
- PropertyFlagDataMap::const_iterator it = m_flagValues.constFind(prop);
+ const auto it = m_flagValues.constFind(prop);
if (it != m_flagValues.constEnd()) {
QVariant v;
v.setValue(it.value().flags);
@@ -1203,35 +1202,35 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
}
}
if (attribute == QLatin1String(validationModesAttributeC)) {
- const PropertyIntMap::const_iterator it = m_stringAttributes.constFind(prop);
+ const auto it = m_stringAttributes.constFind(prop);
if (it != m_stringAttributes.constEnd())
return it.value();
}
if (attribute == QLatin1String(fontAttributeC)) {
- const PropertyFontMap::const_iterator it = m_stringFontAttributes.constFind(prop);
+ const auto it = m_stringFontAttributes.constFind(prop);
if (it != m_stringFontAttributes.constEnd())
return it.value();
}
if (attribute == QLatin1String(themeAttributeC)) {
- const PropertyBoolMap::const_iterator it = m_stringThemeAttributes.constFind(prop);
+ const auto it = m_stringThemeAttributes.constFind(prop);
if (it != m_stringThemeAttributes.constEnd())
return it.value();
}
if (attribute == QLatin1String(superPaletteAttributeC)) {
- PropertyPaletteDataMap::const_iterator it = m_paletteValues.constFind(prop);
- if (it != m_paletteValues.constEnd())
+ const auto it = m_paletteValues.constFind(prop);
+ if (it != m_paletteValues.cend())
return it.value().superPalette;
}
if (attribute == QLatin1String(defaultResourceAttributeC)) {
- QMap<QtProperty *, QPixmap>::const_iterator itPix = m_defaultPixmaps.constFind(prop);
+ const auto itPix = m_defaultPixmaps.constFind(prop);
if (itPix != m_defaultPixmaps.constEnd())
return itPix.value();
- QMap<QtProperty *, QIcon>::const_iterator itIcon = m_defaultIcons.constFind(prop);
+ const auto itIcon = m_defaultIcons.constFind(prop);
if (itIcon != m_defaultIcons.constEnd())
return itIcon.value();
}
@@ -1252,7 +1251,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QMetaType::Bool)
return;
const bool val = value.toBool();
- const PropertyBoolMap::iterator it = m_resetMap.find(property);
+ const auto it = m_resetMap.find(property);
if (it.value() == val)
return;
it.value() = val;
@@ -1264,12 +1263,12 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
return;
const DesignerFlagList flags = qvariant_cast<DesignerFlagList>(value);
- PropertyFlagDataMap::iterator fit = m_flagValues.find(property);
+ const auto fit = m_flagValues.find(property);
FlagData data = fit.value();
if (data.flags == flags)
return;
- PropertyToPropertyListMap::iterator pfit = m_propertyToFlags.find(property);
+ const auto pfit = m_propertyToFlags.find(property);
for (QtProperty *prop : std::as_const(pfit.value())) {
if (prop) {
delete prop;
@@ -1306,7 +1305,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QMetaType::Int)
return;
- const PropertyIntMap::iterator it = m_stringAttributes.find(property);
+ const auto it = m_stringAttributes.find(property);
const int oldValue = it.value();
const int newValue = value.toInt();
@@ -1321,7 +1320,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QMetaType::QFont)
return;
- const PropertyFontMap::iterator it = m_stringFontAttributes.find(property);
+ const auto it = m_stringFontAttributes.find(property);
const QFont oldValue = it.value();
const QFont newValue = qvariant_cast<QFont>(value);
@@ -1336,7 +1335,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QMetaType::Bool)
return;
- const PropertyBoolMap::iterator it = m_stringThemeAttributes.find(property);
+ const auto it = m_stringThemeAttributes.find(property);
const bool oldValue = it.value();
const bool newValue = value.toBool();
@@ -1353,7 +1352,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
QPalette superPalette = qvariant_cast<QPalette>(value);
- const PropertyPaletteDataMap::iterator it = m_paletteValues.find(property);
+ const auto it = m_paletteValues.find(property);
PaletteData data = it.value();
if (data.superPalette == superPalette)
return;
@@ -1378,7 +1377,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
QPixmap defaultPixmap = qvariant_cast<QPixmap>(value);
- const QMap<QtProperty *, QPixmap>::iterator it = m_defaultPixmaps.find(property);
+ const auto it = m_defaultPixmaps.find(property);
QPixmap oldDefaultPixmap = it.value();
if (defaultPixmap.cacheKey() == oldDefaultPixmap.cacheKey())
return;
@@ -1395,7 +1394,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
QIcon defaultIcon = qvariant_cast<QIcon>(value);
- const QMap<QtProperty *, QIcon>::iterator it = m_defaultIcons.find(property);
+ const auto it = m_defaultIcons.find(property);
QIcon oldDefaultIcon = it.value();
if (defaultIcon.cacheKey() == oldDefaultIcon.cacheKey())
return;
@@ -1544,7 +1543,7 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const
if (!theme.isEmpty() && QIcon::hasThemeIcon(theme))
return tr("[Theme] %1").arg(theme);
const auto &paths = icon.paths();
- const PropertySheetIconValue::ModeStateToPixmapMap::const_iterator it = paths.constFind(qMakePair(QIcon::Normal, QIcon::Off));
+ const auto it = paths.constFind(qMakePair(QIcon::Normal, QIcon::Off));
if (it == paths.constEnd())
return QString();
return QFileInfo(it.value().path()).fileName();
@@ -1738,7 +1737,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
- const PropertyFlagDataMap::iterator fit = m_flagValues.find(property);
+ const auto fit = m_flagValues.find(property);
if (fit != m_flagValues.end()) {
if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
@@ -1884,8 +1883,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
emit propertyChanged(property);
QString toolTip;
- const QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue>::ConstIterator itNormalOff =
- iconPaths.constFind(qMakePair(QIcon::Normal, QIcon::Off));
+ const auto itNormalOff = iconPaths.constFind(qMakePair(QIcon::Normal, QIcon::Off));
if (itNormalOff != iconPaths.constEnd())
toolTip = itNormalOff.value().path();
// valueText() only show the file name; show full path as ToolTip.
@@ -2840,8 +2838,7 @@ void ResetDecorator::slotPropertyChanged(QtProperty *property)
void ResetDecorator::slotEditorDestroyed(QObject *object)
{
- const QMap<ResetWidget *, QtProperty *>::ConstIterator rcend = m_resetWidgetToProperty.constEnd();
- for (QMap<ResetWidget *, QtProperty *>::ConstIterator itEditor = m_resetWidgetToProperty.constBegin(); itEditor != rcend; ++itEditor) {
+ for (auto itEditor = m_resetWidgetToProperty.cbegin(), cend = m_resetWidgetToProperty.cend(); itEditor != cend; ++itEditor) {
if (itEditor.key() == object) {
ResetWidget *editor = itEditor.key();
QtProperty *property = itEditor.value();
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.h b/src/designer/src/components/propertyeditor/designerpropertymanager.h
index df05cd6a1..e99267de8 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h
@@ -161,10 +161,9 @@ private:
DesignerFlagList flags;
QList<uint> values;
};
- typedef QMap<QtProperty *, FlagData> PropertyFlagDataMap;
- PropertyFlagDataMap m_flagValues;
- typedef QMap<QtProperty *, QList<QtProperty *> > PropertyToPropertyListMap;
- PropertyToPropertyListMap m_propertyToFlags;
+
+ QMap<QtProperty *, FlagData> m_flagValues;
+ QMap<QtProperty *, QList<QtProperty *>> m_propertyToFlags;
QMap<QtProperty *, QtProperty *> m_flagToProperty;
int alignToIndexH(uint align) const;
@@ -195,8 +194,7 @@ private:
QPalette val;
QPalette superPalette;
};
- typedef QMap<QtProperty *, PaletteData> PropertyPaletteDataMap;
- PropertyPaletteDataMap m_paletteValues;
+ QMap<QtProperty *, PaletteData> m_paletteValues;
QMap<QtProperty *, qdesigner_internal::PropertySheetPixmapValue> m_pixmapValues;
QMap<QtProperty *, qdesigner_internal::PropertySheetIconValue> m_iconValues;
@@ -207,10 +205,8 @@ private:
QMap<QtProperty *, QUrl> m_urlValues;
QMap<QtProperty *, QByteArray> m_byteArrayValues;
- typedef QMap<QtProperty *, int> PropertyIntMap;
- PropertyIntMap m_stringAttributes;
- typedef QMap<QtProperty *, QFont> PropertyFontMap;
- PropertyFontMap m_stringFontAttributes;
+ QMap<QtProperty *, int> m_stringAttributes;
+ QMap<QtProperty *, QFont> m_stringFontAttributes;
PropertyBoolMap m_stringThemeAttributes;
BrushPropertyManager m_brushManager;
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
index f4840d230..c2c059907 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -55,7 +55,7 @@ namespace qdesigner_internal {
ResetMap &resetMap)
{
if (m_createdFontProperty) {
- PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
+ auto it = m_propertyToFontSubProperties.find(m_createdFontProperty);
if (it == m_propertyToFontSubProperties.end())
it = m_propertyToFontSubProperties.insert(m_createdFontProperty, PropertyList());
const int index = it.value().size();
@@ -113,7 +113,7 @@ namespace qdesigner_internal {
// Fiddle family names
if (!m_familyMappings.isEmpty()) {
- const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
+ const auto it = m_propertyToFontSubProperties.find(m_createdFontProperty);
QtVariantProperty *familyProperty = vm->variantProperty(it.value().constFirst());
const QString enumNamesAttribute = u"enumNames"_s;
QStringList plainFamilyNames = familyProperty->attributeValue(enumNamesAttribute).toStringList();
@@ -128,7 +128,7 @@ namespace qdesigner_internal {
bool FontPropertyManager::uninitializeProperty(QtProperty *property)
{
- const PropertyToPropertyMap::iterator ait = m_propertyToAntialiasing.find(property);
+ const auto ait = m_propertyToAntialiasing.find(property);
if (ait != m_propertyToAntialiasing.end()) {
QtProperty *antialiasing = ait.value();
m_antialiasingToProperty.remove(antialiasing);
@@ -136,7 +136,7 @@ namespace qdesigner_internal {
delete antialiasing;
}
- const PropertyToPropertyMap::iterator hit = m_propertyToHintingPreference.find(property);
+ const auto hit = m_propertyToHintingPreference.find(property);
if (hit != m_propertyToHintingPreference.end()) {
QtProperty *hintingPreference = hit.value();
m_hintingPreferenceToProperty.remove(hintingPreference);
@@ -144,7 +144,7 @@ namespace qdesigner_internal {
delete hintingPreference;
}
- PropertyToSubPropertiesMap::iterator sit = m_propertyToFontSubProperties.find(property);
+ const auto sit = m_propertyToFontSubProperties.find(property);
if (sit == m_propertyToFontSubProperties.end())
return false;
@@ -163,7 +163,7 @@ namespace qdesigner_internal {
void FontPropertyManager::removeAntialiasingProperty(QtProperty *property)
{
- const PropertyToPropertyMap::iterator ait = m_antialiasingToProperty.find(property);
+ const auto ait = m_antialiasingToProperty.find(property);
if (ait == m_antialiasingToProperty.end())
return;
m_propertyToAntialiasing[ait.value()] = 0;
@@ -172,7 +172,7 @@ namespace qdesigner_internal {
void FontPropertyManager::removeHintingPreferenceProperty(QtProperty *property)
{
- const PropertyToPropertyMap::iterator hit = m_hintingPreferenceToProperty.find(property);
+ const auto hit = m_hintingPreferenceToProperty.find(property);
if (hit == m_hintingPreferenceToProperty.end())
return;
m_propertyToHintingPreference[hit.value()] = nullptr;
@@ -181,7 +181,7 @@ namespace qdesigner_internal {
bool FontPropertyManager::resetFontSubProperty(QtVariantPropertyManager *vm, QtProperty *property)
{
- const PropertyToPropertyMap::iterator it = m_fontSubPropertyToProperty.find(property);
+ const auto it = m_fontSubPropertyToProperty.find(property);
if (it == m_fontSubPropertyToProperty.end())
return false;
@@ -316,7 +316,7 @@ namespace qdesigner_internal {
void FontPropertyManager::updateModifiedState(QtProperty *property, const QVariant &value)
{
- const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(property);
+ const auto it = m_propertyToFontSubProperties.find(property);
if (it == m_propertyToFontSubProperties.end())
return;
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.h b/src/designer/src/components/propertyeditor/fontpropertymanager.h
index 335447b3a..85c606c76 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.h
@@ -57,7 +57,6 @@ public:
private:
using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>;
using PropertyList = QList<QtProperty *>;
- using PropertyToSubPropertiesMap = QMap<QtProperty *, PropertyList>;
void removeAntialiasingProperty(QtProperty *);
void removeHintingPreferenceProperty(QtProperty *);
@@ -80,7 +79,7 @@ private:
PropertyToPropertyMap m_hintingPreferenceToProperty;
- PropertyToSubPropertiesMap m_propertyToFontSubProperties;
+ QMap<QtProperty *, PropertyList> m_propertyToFontSubProperties;
QMap<QtProperty *, int> m_fontSubPropertyToFlag;
PropertyToPropertyMap m_fontSubPropertyToProperty;
QtProperty *m_createdFontProperty = nullptr;
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp
index 2a464b5d4..790a7a347 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -333,11 +333,9 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
break;
}
// Restore expansionState from QVariant map
- if (!expansionState.isEmpty()) {
- const QVariantMap::const_iterator cend = expansionState.constEnd();
- for (QVariantMap::const_iterator it = expansionState.constBegin(); it != cend; ++it)
- m_expansionState.insert(it.key(), it.value().toBool());
- }
+ for (auto it = expansionState.cbegin(), cend = expansionState.cend(); it != cend; ++it)
+ m_expansionState.insert(it.key(), it.value().toBool());
+
updateActionsState();
}
@@ -359,11 +357,8 @@ void PropertyEditor::saveSettings() const
settings->setValue(QLatin1String(SortedKeyC), QVariant(m_sorting));
// Save last expansionState as QVariant map
QVariantMap expansionState;
- if (!m_expansionState.isEmpty()) {
- const QMap<QString, bool>::const_iterator cend = m_expansionState.constEnd();
- for (QMap<QString, bool>::const_iterator it = m_expansionState.constBegin(); it != cend; ++it)
- expansionState.insert(it.key(), QVariant(it.value()));
- }
+ for (auto it = m_expansionState.cbegin(), cend = m_expansionState.cend(); it != cend; ++it)
+ expansionState.insert(it.key(), QVariant(it.value()));
settings->setValue(QLatin1String(ExpansionKeyC), expansionState);
settings->setValue(QLatin1String(SplitterPositionKeyC), m_treeBrowser->splitterPosition());
settings->endGroup();
@@ -448,13 +443,13 @@ void PropertyEditor::collapseAll()
void PropertyEditor::applyPropertiesExpansionState(const QList<QtBrowserItem *> &items)
{
for (QtBrowserItem *propertyItem : items) {
- const QMap<QString, bool>::const_iterator excend = m_expansionState.constEnd();
+ const auto excend = m_expansionState.cend();
QtProperty *property = propertyItem->property();
const QString propertyName = property->propertyName();
const auto itGroup = m_propertyToGroup.constFind(property);
if (itGroup != m_propertyToGroup.constEnd()) {
const QString key = itGroup.value() + u'|' + propertyName;
- const QMap<QString, bool>::const_iterator pit = m_expansionState.constFind(key);
+ const auto pit = m_expansionState.constFind(key);
if (pit != excend)
setExpanded(propertyItem, pit.value());
else
@@ -469,10 +464,10 @@ void PropertyEditor::applyExpansionState()
if (m_sorting) {
applyPropertiesExpansionState(items);
} else {
- const QMap<QString, bool>::const_iterator excend = m_expansionState.constEnd();
+ const auto excend = m_expansionState.cend();
for (QtBrowserItem *item : items) {
const QString groupName = item->property()->propertyName();
- const QMap<QString, bool>::const_iterator git = m_expansionState.constFind(groupName);
+ const auto git = m_expansionState.constFind(groupName);
if (git != excend)
setExpanded(item, git.value());
else
@@ -699,7 +694,7 @@ void PropertyEditor::setReadOnly(bool /*readOnly*/)
void PropertyEditor::setPropertyValue(const QString &name, const QVariant &value, bool changed)
{
- const QMap<QString, QtVariantProperty*>::const_iterator it = m_nameToProperty.constFind(name);
+ const auto it = m_nameToProperty.constFind(name);
if (it == m_nameToProperty.constEnd())
return;
QtVariantProperty *property = it.value();
@@ -717,10 +712,10 @@ void PropertyEditor::updatePropertySheet()
updateToolBarLabel();
const int propertyCount = m_propertySheet->count();
- const QMap<QString, QtVariantProperty*>::const_iterator npcend = m_nameToProperty.constEnd();
+ const auto npcend = m_nameToProperty.cend();
for (int i = 0; i < propertyCount; ++i) {
const QString propertyName = m_propertySheet->propertyName(i);
- QMap<QString, QtVariantProperty*>::const_iterator it = m_nameToProperty.constFind(propertyName);
+ const auto it = m_nameToProperty.constFind(propertyName);
if (it != npcend)
updateBrowserValue(it.value(), m_propertySheet->property(i));
}
@@ -914,7 +909,7 @@ void PropertyEditor::setObject(QObject *object)
if (m_propertySheet->indexOf(propertyName) != i)
continue;
const QString groupName = m_propertySheet->propertyGroup(i);
- const QMap<QString, QtVariantProperty *>::const_iterator rit = toRemove.constFind(propertyName);
+ const auto rit = toRemove.constFind(propertyName);
if (rit != toRemove.constEnd()) {
QtVariantProperty *property = rit.value();
const int propertyType = property->propertyType();
@@ -1033,7 +1028,7 @@ void PropertyEditor::setObject(QObject *object)
m_currentBrowser->insertProperty(property, previous);
}
}
- const QMap<QString, QtVariantProperty*>::const_iterator gnit = m_nameToGroup.constFind(groupName);
+ const auto gnit = m_nameToGroup.constFind(groupName);
if (gnit != m_nameToGroup.constEnd()) {
groupProperty = gnit.value();
} else {
diff --git a/src/designer/src/components/signalsloteditor/connectdialog.cpp b/src/designer/src/components/signalsloteditor/connectdialog.cpp
index 032e33f7a..1a6edc51c 100644
--- a/src/designer/src/components/signalsloteditor/connectdialog.cpp
+++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp
@@ -195,9 +195,7 @@ void ConnectDialog::populateSlotList(const QString &signal)
QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = nullptr;
- QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
- const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd();
- while (itMember != itMemberEnd) {
+ for (auto itMember = memberToClassName.cbegin(), itMemberEnd = memberToClassName.cend(); itMember != itMemberEnd; ++itMember) {
const QString member = itMember.key();
QListWidgetItem *item = new QListWidgetItem(m_ui.slotList);
item->setText(member);
@@ -210,7 +208,6 @@ void ConnectDialog::populateSlotList(const QString &signal)
item->setData(Qt::FontRole, variantFont);
item->setData(Qt::ForegroundRole, QColor(Qt::red));
}
- ++itMember;
}
if (curr)
@@ -237,9 +234,7 @@ void ConnectDialog::populateSignalList()
QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = nullptr;
- QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
- const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd();
- while (itMember != itMemberEnd) {
+ for (auto itMember = memberToClassName.cbegin(), itMemberEnd = memberToClassName.cend(); itMember != itMemberEnd; ++itMember) {
const QString member = itMember.key();
QListWidgetItem *item = new QListWidgetItem(m_ui.signalList);
@@ -253,7 +248,6 @@ void ConnectDialog::populateSignalList()
item->setData(Qt::FontRole, variantFont);
item->setData(Qt::ForegroundRole, QColor(Qt::red));
}
- ++itMember;
}
if (curr) {
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index 38a96148d..aa8185483 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -433,16 +433,13 @@ void InlineEditorModel::addTextList(const QMap<QString, bool> &text_list)
QFont font = QApplication::font();
font.setItalic(true);
QVariant fontVariant = QVariant::fromValue(font);
- QMap<QString, bool>::ConstIterator it = text_list.constBegin();
- const QMap<QString, bool>::ConstIterator itEnd = text_list.constEnd();
- while (it != itEnd) {
+ for (auto it = text_list.cbegin(), itEnd = text_list.cend(); it != itEnd; ++it) {
const QModelIndex text_idx = index(cnt++, 0);
setData(text_idx, it.key(), Qt::DisplayRole);
if (it.value()) {
setData(text_idx, fontVariant, Qt::FontRole);
setData(text_idx, QColor(Qt::red), Qt::ForegroundRole);
}
- ++it;
}
}
diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
index ce1ce1a70..2a94ef535 100644
--- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
@@ -107,10 +107,8 @@ public:
bool removeCustomWidgets();
private:
- using WidgetBoxCategoryEntrys = QList<WidgetBoxCategoryEntry>;
-
QDesignerFormEditorInterface *m_core;
- WidgetBoxCategoryEntrys m_items;
+ QList<WidgetBoxCategoryEntry> m_items;
QListView::ViewMode m_viewMode;
};
@@ -159,7 +157,7 @@ bool WidgetBoxCategoryModel::removeCustomWidgets()
// Typically, we are a whole category of custom widgets, so, remove all
// and do reset.
bool changed = false;
- for (WidgetBoxCategoryEntrys::iterator it = m_items.begin(); it != m_items.end(); )
+ for (auto it = m_items.begin(); it != m_items.end(); )
if (it->widget.type() == QDesignerWidgetBoxInterface::Widget::Custom) {
if (!changed)
beginResetModel();
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
index 094f6057b..abb27aad8 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
@@ -91,7 +91,7 @@ QIcon WidgetBoxTreeWidget::iconForWidget(const QString &iconName) const
return qdesigner_internal::qtLogoIcon();
if (iconName.startsWith(QLatin1String(iconPrefixC))) {
- const IconCache::const_iterator it = m_pluginIcons.constFind(iconName);
+ const auto it = m_pluginIcons.constFind(iconName);
if (it != m_pluginIcons.constEnd())
return it.value();
}
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.h b/src/designer/src/components/widgetbox/widgetboxtreewidget.h
index 88b4b46e5..f55708105 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.h
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.h
@@ -99,8 +99,7 @@ private:
QDesignerFormEditorInterface *m_core;
QString m_file_name;
- using IconCache = QHash<QString, QIcon>;
- mutable IconCache m_pluginIcons;
+ mutable QHash<QString, QIcon> m_pluginIcons;
bool m_iconMode;
QTimer *m_scratchPadDeleteTimer;
};
diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp
index 6c9e1d2c5..08a6ede18 100644
--- a/src/designer/src/designer/mainwindow.cpp
+++ b/src/designer/src/designer/mainwindow.cpp
@@ -214,7 +214,7 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
// Filter out the device profile preview actions which have int data().
ActionList previewActions = actions->styleActions()->actions();
- ActionList::iterator it = previewActions.begin();
+ auto it = previewActions.begin();
for ( ; (*it)->isSeparator() || (*it)->data().metaType().id() == QMetaType::Int; ++it) ;
previewActions.erase(previewActions.begin(), it);
addActionsToToolBarManager(previewActions, tr("Style"), m_manager);
diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp
index 58c856047..044ca16f8 100644
--- a/src/designer/src/designer/qdesigner_workbench.cpp
+++ b/src/designer/src/designer/qdesigner_workbench.cpp
@@ -435,7 +435,7 @@ void QDesignerWorkbench::adjustMDIFormPositions()
const QPoint mdiAreaOffset = m_dockedMainWindow->mdiArea()->pos();
for (QDesignerFormWindow *fw : std::as_const(m_formWindows)) {
- const PositionMap::const_iterator pit = m_Positions.constFind(fw);
+ const auto pit = m_Positions.constFind(fw);
if (pit != m_Positions.constEnd())
pit->applyTo(mdiSubWindowOf(fw), mdiAreaOffset);
}
@@ -503,7 +503,7 @@ void QDesignerWorkbench::switchToTopLevelMode()
for (QDesignerFormWindow *fw : std::as_const(m_formWindows)) {
fw->setParent(magicalParent(fw), magicalWindowFlags(fw));
fw->setAttribute(Qt::WA_DeleteOnClose, true);
- const PositionMap::const_iterator pit = m_Positions.constFind(fw);
+ const auto pit = m_Positions.constFind(fw);
if (pit != m_Positions.constEnd()) pit->applyTo(fw, desktopOffset);
// Force an activate in order to refresh minimumSize, otherwise it will not be respected
if (QLayout *layout = fw->layout())
diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp
index 99eb1a5eb..9513c6115 100644
--- a/src/designer/src/lib/extension/default_extensionfactory.cpp
+++ b/src/designer/src/lib/extension/default_extensionfactory.cpp
@@ -79,7 +79,7 @@ QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const
return nullptr;
const IdObjectKey key = qMakePair(iid, object);
- ExtensionMap::iterator it = m_extensions.find(key);
+ auto it = m_extensions.find(key);
if (it == m_extensions.end()) {
if (QObject *ext = createExtension(object, iid, const_cast<QExtensionFactory*>(this))) {
connect(ext, &QObject::destroyed, this, &QExtensionFactory::objectDestroyed);
diff --git a/src/designer/src/lib/extension/default_extensionfactory.h b/src/designer/src/lib/extension/default_extensionfactory.h
index 589ade795..8ff1dd9e1 100644
--- a/src/designer/src/lib/extension/default_extensionfactory.h
+++ b/src/designer/src/lib/extension/default_extensionfactory.h
@@ -34,8 +34,7 @@ protected:
private:
typedef QPair<QString,QObject*> IdObjectKey;
- typedef QMap< IdObjectKey, QObject*> ExtensionMap;
- mutable ExtensionMap m_extensions;
+ mutable QMap< IdObjectKey, QObject *> m_extensions;
mutable QSet<QObject *> m_extended;
};
diff --git a/src/designer/src/lib/extension/qextensionmanager.cpp b/src/designer/src/lib/extension/qextensionmanager.cpp
index b146a51b3..40207a174 100644
--- a/src/designer/src/lib/extension/qextensionmanager.cpp
+++ b/src/designer/src/lib/extension/qextensionmanager.cpp
@@ -81,7 +81,7 @@ void QExtensionManager::registerExtensions(QAbstractExtensionFactory *factory, c
return;
}
- FactoryMap::iterator it = m_extensions.find(iid);
+ auto it = m_extensions.find(iid);
if (it == m_extensions.end())
it = m_extensions.insert(iid, FactoryList());
@@ -99,7 +99,7 @@ void QExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory,
return;
}
- const FactoryMap::iterator it = m_extensions.find(iid);
+ const auto it = m_extensions.find(iid);
if (it == m_extensions.end())
return;
@@ -116,7 +116,7 @@ void QExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory,
*/
QObject *QExtensionManager::extension(QObject *object, const QString &iid) const
{
- const FactoryMap::const_iterator it = m_extensions.constFind(iid);
+ const auto it = m_extensions.constFind(iid);
if (it != m_extensions.constEnd()) {
for (const auto &f : it.value()) {
if (QObject *ext = f->extension(object, iid))
diff --git a/src/designer/src/lib/extension/qextensionmanager.h b/src/designer/src/lib/extension/qextensionmanager.h
index af7d75c18..0fb2bcd9e 100644
--- a/src/designer/src/lib/extension/qextensionmanager.h
+++ b/src/designer/src/lib/extension/qextensionmanager.h
@@ -27,8 +27,7 @@ public:
private:
using FactoryList = QList<QAbstractExtensionFactory *>;
- typedef QHash<QString, FactoryList> FactoryMap;
- FactoryMap m_extensions;
+ QHash<QString, FactoryList> m_extensions;
FactoryList m_globalExtension;
};
diff --git a/src/designer/src/lib/shared/connectionedit.cpp b/src/designer/src/lib/shared/connectionedit.cpp
index 42f13a1ae..d92ca00e2 100644
--- a/src/designer/src/lib/shared/connectionedit.cpp
+++ b/src/designer/src/lib/shared/connectionedit.cpp
@@ -1333,9 +1333,9 @@ static ConnectionEdit::ConnectionSet findConnectionsOf(const ConnectionEdit::Con
{
ConnectionEdit::ConnectionSet rc;
- const ConnectionEdit::ConnectionList::const_iterator ccend = cl.constEnd();
+ const auto ccend = cl.cend();
for ( ; oi1 != oi2; ++oi1) {
- for (ConnectionEdit::ConnectionList::const_iterator cit = cl.constBegin(); cit != ccend; ++cit) {
+ for (auto cit = cl.constBegin(); cit != ccend; ++cit) {
Connection *con = *cit;
if (con->object(ConnectionEdit::EndPoint::Source) == *oi1 || con->object(ConnectionEdit::EndPoint::Target) == *oi1)
rc.insert(con, con);
diff --git a/src/designer/src/lib/shared/grid.cpp b/src/designer/src/lib/shared/grid.cpp
index 45a351631..ab36fcbf6 100644
--- a/src/designer/src/lib/shared/grid.cpp
+++ b/src/designer/src/lib/shared/grid.cpp
@@ -34,7 +34,7 @@ template <class T>
// Obtain a value form QVariantMap
template <class T>
static inline bool valueFromVariantMap(const QVariantMap &v, const QString &key, T &value) {
- const QVariantMap::const_iterator it = v.constFind(key);
+ const auto it = v.constFind(key);
const bool found = it != v.constEnd();
if (found)
value = qvariant_cast<T>(it.value());
diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp
index 46c8f635a..860148aa7 100644
--- a/src/designer/src/lib/shared/layout.cpp
+++ b/src/designer/src/lib/shared/layout.cpp
@@ -1095,7 +1095,7 @@ void removeIntVecDuplicates(QList<int> &v)
if (v.size() < 2)
return;
- for (QList<int>::iterator current = v.begin() ; (current != v.end()) && ((current+1) != v.end()) ; )
+ for (auto current = v.begin() ; (current != v.end()) && ((current + 1) != v.end()) ; )
if ( *current == *(current+1) )
v.erase(current+1);
else
diff --git a/src/designer/src/lib/shared/metadatabase.cpp b/src/designer/src/lib/shared/metadatabase.cpp
index 1534cc51f..77d6aa23c 100644
--- a/src/designer/src/lib/shared/metadatabase.cpp
+++ b/src/designer/src/lib/shared/metadatabase.cpp
@@ -145,8 +145,7 @@ QObjectList MetaDataBase::objects() const
{
QObjectList result;
- ItemMap::const_iterator it = m_items.begin();
- for (; it != m_items.end(); ++it) {
+ for (auto it = m_items.cbegin(), cend = m_items.cend(); it != cend; ++it) {
if (it.value()->enabled())
result.append(it.key());
}
diff --git a/src/designer/src/lib/shared/metadatabase_p.h b/src/designer/src/lib/shared/metadatabase_p.h
index 8c5e0e17d..2117f5975 100644
--- a/src/designer/src/lib/shared/metadatabase_p.h
+++ b/src/designer/src/lib/shared/metadatabase_p.h
@@ -81,8 +81,7 @@ private slots:
private:
QDesignerFormEditorInterface *m_core;
- typedef QHash<QObject *, MetaDataBaseItem*> ItemMap;
- ItemMap m_items;
+ QHash<QObject *, MetaDataBaseItem *> m_items;
};
// promotion convenience
diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp
index fb36d4680..41ec43f9f 100644
--- a/src/designer/src/lib/shared/morphmenu.cpp
+++ b/src/designer/src/lib/shared/morphmenu.cpp
@@ -124,9 +124,8 @@ static MorphCategory category(const QWidget *w)
static QStringList classesOfCategory(MorphCategory cat)
{
- typedef QMap<MorphCategory, QStringList> CandidateCache;
- static CandidateCache candidateCache;
- CandidateCache::iterator it = candidateCache.find(cat);
+ static QMap<MorphCategory, QStringList> candidateCache;
+ auto it = candidateCache.find(cat);
if (it == candidateCache.end()) {
it = candidateCache.insert(cat, QStringList());
QStringList &l = it.value();
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp
index 1ed86700a..d5aff2c46 100644
--- a/src/designer/src/lib/shared/newformwidget.cpp
+++ b/src/designer/src/lib/shared/newformwidget.cpp
@@ -235,7 +235,7 @@ QPixmap NewFormWidget::formPreviewPixmap(const QTreeWidgetItem *item)
{
// Cache pixmaps per item/device profile
const ItemPixmapCacheKey cacheKey(item, profileComboIndex());
- ItemPixmapCache::iterator it = m_itemPixmapCache.find(cacheKey);
+ auto it = m_itemPixmapCache.find(cacheKey);
if (it == m_itemPixmapCache.end()) {
// file or string?
const QVariant fileName = item->data(0, TemplateNameRole);
diff --git a/src/designer/src/lib/shared/orderdialog.cpp b/src/designer/src/lib/shared/orderdialog.cpp
index cecfd35d0..12dcbc3cc 100644
--- a/src/designer/src/lib/shared/orderdialog.cpp
+++ b/src/designer/src/lib/shared/orderdialog.cpp
@@ -64,8 +64,7 @@ void OrderDialog::setPageList(const QWidgetList &pages)
void OrderDialog::buildList()
{
m_ui->pageList->clear();
- const OrderMap::const_iterator cend = m_orderMap.constEnd();
- for (OrderMap::const_iterator it = m_orderMap.constBegin(); it != cend; ++it) {
+ for (auto it = m_orderMap.cbegin(), cend = m_orderMap.cend(); it != cend; ++it) {
QListWidgetItem *item = new QListWidgetItem();
const int index = it.key();
switch (m_format) {
diff --git a/src/designer/src/lib/shared/orderdialog_p.h b/src/designer/src/lib/shared/orderdialog_p.h
index 3f7f20797..456fb9406 100644
--- a/src/designer/src/lib/shared/orderdialog_p.h
+++ b/src/designer/src/lib/shared/orderdialog_p.h
@@ -63,8 +63,7 @@ private:
void buildList();
void enableButtons(int r);
- typedef QMap<int, QWidget*> OrderMap;
- OrderMap m_orderMap;
+ QMap<int, QWidget *> m_orderMap;
Ui::OrderDialog* m_ui;
Format m_format;
};
diff --git a/src/designer/src/lib/shared/pluginmanager.cpp b/src/designer/src/lib/shared/pluginmanager.cpp
index 7ab9d17aa..5f824853f 100644
--- a/src/designer/src/lib/shared/pluginmanager.cpp
+++ b/src/designer/src/lib/shared/pluginmanager.cpp
@@ -101,8 +101,6 @@ class QDesignerCustomWidgetSharedData : public QSharedData {
public:
// Type of a string property
using StringPropertyType = QPair<qdesigner_internal::TextPropertyValidationMode, bool>;
- using StringPropertyTypeMap = QHash<QString, StringPropertyType>;
- using PropertyToolTipMap = QHash<QString, QString>;
explicit QDesignerCustomWidgetSharedData(const QString &thePluginPath) : pluginPath(thePluginPath) {}
void clearXML();
@@ -115,8 +113,8 @@ public:
QString xmlAddPageMethod;
QString xmlExtends;
- StringPropertyTypeMap xmlStringPropertyTypeMap;
- PropertyToolTipMap propertyToolTipMap;
+ QHash<QString, StringPropertyType> xmlStringPropertyTypeMap;
+ QHash<QString, QString> propertyToolTipMap;
};
void QDesignerCustomWidgetSharedData::clearXML()
@@ -188,7 +186,7 @@ QString QDesignerCustomWidgetData::pluginPath() const
bool QDesignerCustomWidgetData::xmlStringPropertyType(const QString &name, StringPropertyType *type) const
{
- QDesignerCustomWidgetSharedData::StringPropertyTypeMap::const_iterator it = m_d->xmlStringPropertyTypeMap.constFind(name);
+ const auto it = m_d->xmlStringPropertyTypeMap.constFind(name);
if (it == m_d->xmlStringPropertyTypeMap.constEnd()) {
*type = StringPropertyType(qdesigner_internal::ValidationRichText, true);
return false;
@@ -437,8 +435,7 @@ class QDesignerPluginManagerPrivate {
// TODO: QPluginLoader also caches invalid plugins -> This seems to be dead code
QStringList m_disabledPlugins;
- typedef QMap<QString, QString> FailedPluginMap;
- FailedPluginMap m_failedPlugins;
+ QMap<QString, QString> m_failedPlugins;
// Synced lists of custom widgets and their data. Note that the list
// must be ordered for collections to appear in order.
@@ -669,7 +666,7 @@ void QDesignerPluginManager::registerPlugin(const QString &plugin)
QPluginLoader loader(plugin);
if (loader.isLoaded() || loader.load()) {
m_d->m_registeredPlugins += plugin;
- QDesignerPluginManagerPrivate::FailedPluginMap::iterator fit = m_d->m_failedPlugins.find(plugin);
+ const auto fit = m_d->m_failedPlugins.find(plugin);
if (fit != m_d->m_failedPlugins.end())
m_d->m_failedPlugins.erase(fit);
return;
diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp
index 33e34c5a2..e86d6a8f9 100644
--- a/src/designer/src/lib/shared/previewmanager.cpp
+++ b/src/designer/src/lib/shared/previewmanager.cpp
@@ -532,8 +532,7 @@ public:
PreviewDataList m_previews;
- typedef QMap<QString, DeviceSkinParameters> DeviceSkinConfigCache;
- DeviceSkinConfigCache m_deviceSkinConfigCache;
+ QMap<QString, DeviceSkinParameters> m_deviceSkinConfigCache;
QDesignerFormEditorInterface *m_core;
bool m_updateBlocked;
@@ -676,7 +675,7 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw,
return formWidget;
}
// Embed into skin. find config in cache
- PreviewManagerPrivate::DeviceSkinConfigCache::iterator it = d->m_deviceSkinConfigCache.find(deviceSkin);
+ auto it = d->m_deviceSkinConfigCache.find(deviceSkin);
if (it == d->m_deviceSkinConfigCache.end()) {
DeviceSkinParameters parameters;
if (!parameters.read(deviceSkin, DeviceSkinParameters::ReadAll, errorMessage)) {
@@ -801,11 +800,10 @@ void PreviewManager::closeAllPreviews()
void PreviewManager::updatePreviewClosed(QWidget *w)
{
- using PreviewDataList = PreviewManagerPrivate::PreviewDataList;
if (d->m_updateBlocked)
return;
// Purge out all 0 or widgets to be deleted
- for (PreviewDataList::iterator it = d->m_previews.begin(); it != d->m_previews.end() ; ) {
+ for (auto it = d->m_previews.begin(); it != d->m_previews.end() ; ) {
QWidget *iw = it->m_widget; // Might be 0 when catching QEvent::Destroyed
if (iw == nullptr || iw == w) {
it = d->m_previews.erase(it);
diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp
index 91b5bf443..bd49acb4c 100644
--- a/src/designer/src/lib/shared/qdesigner_command.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command.cpp
@@ -2385,9 +2385,10 @@ void TableWidgetContents::applyToTableWidget(QTableWidget *tableWidget, Designer
row++;
}
// items
- const TableItemMap::const_iterator icend = m_items.constEnd();
- for (TableItemMap::const_iterator it = m_items.constBegin(); it != icend; ++ it)
- tableWidget->setItem(it.key().first, it.key().second, it.value().createTableItem(iconCache, editor));
+ for (auto it = m_items.cbegin(), icend = m_items.cend(); it != icend; ++ it) {
+ tableWidget->setItem(it.key().first, it.key().second,
+ it.value().createTableItem(iconCache, editor));
+ }
}
bool TableWidgetContents::operator==(const TableWidgetContents &rhs) const
diff --git a/src/designer/src/lib/shared/qdesigner_command_p.h b/src/designer/src/lib/shared/qdesigner_command_p.h
index 7a408a9ab..86afb0916 100644
--- a/src/designer/src/lib/shared/qdesigner_command_p.h
+++ b/src/designer/src/lib/shared/qdesigner_command_p.h
@@ -856,7 +856,6 @@ struct QDESIGNER_SHARED_EXPORT ListContents {
struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
using CellRowColumnAddress = QPair<int, int>;
- using TableItemMap = QMap<CellRowColumnAddress, ItemData>;
TableWidgetContents();
void clear();
@@ -875,7 +874,7 @@ struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
int m_rowCount = 0;
ListContents m_horizontalHeader;
ListContents m_verticalHeader;
- TableItemMap m_items;
+ QMap<CellRowColumnAddress, ItemData> m_items;
};
class QDESIGNER_SHARED_EXPORT ChangeTableContentsCommand: public QDesignerFormWindowCommand
diff --git a/src/designer/src/lib/shared/qdesigner_dnditem.cpp b/src/designer/src/lib/shared/qdesigner_dnditem.cpp
index cfc5c0221..7dc853114 100644
--- a/src/designer/src/lib/shared/qdesigner_dnditem.cpp
+++ b/src/designer/src/lib/shared/qdesigner_dnditem.cpp
@@ -121,8 +121,8 @@ QDesignerMimeData::QDesignerMimeData(const QDesignerDnDItems &items, QDrag *drag
break;
default: {
// determine size of drag decoration by uniting all geometries
- const QDesignerDnDItems::const_iterator cend = m_items.constEnd();
- QDesignerDnDItems::const_iterator it =m_items.constBegin();
+ const auto cend = m_items.cend();
+ auto it = m_items.cbegin();
QRect unitedGeometry = (*it)->decoration()->geometry();
const qreal devicePixelRatio = (*it)->decoration()->devicePixelRatioF();
for (++it; it != cend; ++it )
diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
index 8eae5be07..5451222fe 100644
--- a/src/designer/src/lib/shared/qdesigner_membersheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
@@ -35,11 +35,9 @@ public:
bool visible{true};
};
- using InfoHash = QHash<int, Info>;
-
Info &ensureInfo(int index);
- InfoHash m_info;
+ QHash<int, Info> m_info;
};
QDesignerMemberSheetPrivate::QDesignerMemberSheetPrivate(QObject *object, QObject *sheetParent) :
@@ -50,10 +48,9 @@ QDesignerMemberSheetPrivate::QDesignerMemberSheetPrivate(QObject *object, QObjec
QDesignerMemberSheetPrivate::Info &QDesignerMemberSheetPrivate::ensureInfo(int index)
{
- InfoHash::iterator it = m_info.find(index);
- if (it == m_info.end()) {
+ auto it = m_info.find(index);
+ if (it == m_info.end())
it = m_info.insert(index, Info());
- }
return it.value();
}
diff --git a/src/designer/src/lib/shared/qdesigner_promotion.cpp b/src/designer/src/lib/shared/qdesigner_promotion.cpp
index 53b9eb1df..eb78dd413 100644
--- a/src/designer/src/lib/shared/qdesigner_promotion.cpp
+++ b/src/designer/src/lib/shared/qdesigner_promotion.cpp
@@ -180,9 +180,7 @@ namespace qdesigner_internal {
{
using ClassNameItemMap = QMap<QString, QDesignerWidgetDataBaseItemInterface *>;
// A map containing base classes and their promoted classes.
- using BaseClassPromotedMap = QMap<QString, ClassNameItemMap>;
-
- BaseClassPromotedMap baseClassPromotedMap;
+ QMap<QString, ClassNameItemMap> baseClassPromotedMap;
QDesignerWidgetDataBaseInterface *widgetDataBase = m_core->widgetDataBase();
// Look for promoted classes and insert into map according to base class.
@@ -191,7 +189,7 @@ namespace qdesigner_internal {
QDesignerWidgetDataBaseItemInterface *dbItem = widgetDataBase->item(i);
if (dbItem->isPromoted()) {
const QString baseClassName = dbItem->extends();
- BaseClassPromotedMap::iterator it = baseClassPromotedMap.find(baseClassName);
+ auto it = baseClassPromotedMap.find(baseClassName);
if (it == baseClassPromotedMap.end()) {
it = baseClassPromotedMap.insert(baseClassName, ClassNameItemMap());
}
@@ -204,14 +202,12 @@ namespace qdesigner_internal {
if (baseClassPromotedMap.isEmpty())
return rc;
- const BaseClassPromotedMap::const_iterator bcend = baseClassPromotedMap.constEnd();
- for (BaseClassPromotedMap::const_iterator bit = baseClassPromotedMap.constBegin(); bit != bcend; ++bit) {
+ for (auto bit = baseClassPromotedMap.cbegin(), bcend = baseClassPromotedMap.cend(); bit != bcend; ++bit) {
const int baseIndex = widgetDataBase->indexOfClassName(bit.key());
Q_ASSERT(baseIndex >= 0);
QDesignerWidgetDataBaseItemInterface *baseItem = widgetDataBase->item(baseIndex);
// promoted
- const ClassNameItemMap::const_iterator pcend = bit.value().constEnd();
- for (ClassNameItemMap::const_iterator pit = bit.value().constBegin(); pit != pcend; ++pit) {
+ for (auto pit = bit.value().cbegin(), pcend = bit.value().cend(); pit != pcend; ++pit) {
PromotedClass item;
item.baseItem = baseItem;
item.promotedItem = pit.value();
diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
index 2e277e4e7..2b99aa92c 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -1087,7 +1087,7 @@ template <class PropertyListIterator, class Function>
QDesignerPropertyEditorInterface *propertyEditor = core->propertyEditor();
bool updatedPropertyEditor = false;
- for (PropertyListIterator it = begin; it != end; ++it) {
+ for (auto it = begin; it != end; ++it) {
PropertyHelper *ph = it->get();
if (QObject* object = ph->object()) { // Might have been deleted in the meantime
const PropertyHelper::Value newValue = function( *ph );
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index 866dbe95a..42a04b753 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
@@ -105,7 +105,7 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
return StringPropertyParameters(ValidationMultiLine, true);
// Check hardcoded property ames
- const PropertyNameTypeMap::const_iterator hit = stringPropertyTypes().constFind(propertyName);
+ const auto hit = stringPropertyTypes().constFind(propertyName);
if (hit != stringPropertyTypes().constEnd())
return hit.value();
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index dc6850f6f..b949ff9b0 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -97,14 +97,13 @@ static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *obj
static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDesignerMetaEnumInterface *me)
{
using ScopeNameKey = QPair<QString, QString>;
- using DesignerMetaEnumCache = QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum>;
- static DesignerMetaEnumCache cache;
+ static QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum> cache;
const QString name = me->name();
const QString scope = me->scope();
const ScopeNameKey key = ScopeNameKey(scope, name);
- DesignerMetaEnumCache::iterator it = cache.find(key);
+ auto it = cache.find(key);
if (it == cache.end()) {
qdesigner_internal::DesignerMetaEnum dme = qdesigner_internal::DesignerMetaEnum(name, scope, me->separator());
const int keyCount = me->keyCount();
@@ -119,14 +118,13 @@ static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDe
static const qdesigner_internal::DesignerMetaFlags &designerMetaFlagsFor(const QDesignerMetaEnumInterface *me)
{
using ScopeNameKey = QPair<QString, QString>;
- using DesignerMetaFlagsCache = QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags>;
- static DesignerMetaFlagsCache cache;
+ static QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags> cache;
const QString name = me->name();
const QString scope = me->scope();
const ScopeNameKey key = ScopeNameKey(scope, name);
- DesignerMetaFlagsCache::iterator it = cache.find(key);
+ auto it = cache.find(key);
if (it == cache.end()) {
qdesigner_internal::DesignerMetaFlags dme = qdesigner_internal::DesignerMetaFlags(name, scope, me->separator());
const int keyCount = me->keyCount();
@@ -199,8 +197,7 @@ public:
const ObjectType m_objectType;
const ObjectFlags m_objectFlags;
- using InfoHash = QHash<int, Info>;
- InfoHash m_info;
+ QHash<int, Info> m_info;
QHash<int, QVariant> m_fakeProperties;
QHash<int, QVariant> m_addProperties;
QHash<QString, int> m_addIndex;
@@ -424,7 +421,7 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension *
QDesignerPropertySheetPrivate::Info &QDesignerPropertySheetPrivate::ensureInfo(int index)
{
- InfoHash::iterator it = m_info.find(index);
+ auto it = m_info.find(index);
if (it == m_info.end())
it = m_info.insert(index, Info());
return it.value();
@@ -432,7 +429,7 @@ QDesignerPropertySheetPrivate::Info &QDesignerPropertySheetPrivate::ensureInfo(i
QDesignerPropertySheet::PropertyType QDesignerPropertySheetPrivate::propertyType(int index) const
{
- const InfoHash::const_iterator it = m_info.constFind(index);
+ const auto it = m_info.constFind(index);
if (it == m_info.constEnd())
return QDesignerPropertySheet::PropertyNone;
return it.value().propertyType;
@@ -461,7 +458,7 @@ QString QDesignerPropertySheetPrivate::transformLayoutPropertyName(int index) co
{QDesignerPropertySheet::PropertyLayoutGridRowMinimumHeight, u"rowMinimumHeight"_s},
{QDesignerPropertySheet::PropertyLayoutGridColumnMinimumWidth, u"columnMinimumWidth"_s}
};
- const TypeNameMap::const_iterator it = typeNameMap.constFind(propertyType(index));
+ const auto it = typeNameMap.constFind(propertyType(index));
if (it != typeNameMap.constEnd())
return it.value();
return QString();
diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp
index bb71f3f2e..f0a2a4692 100644
--- a/src/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/src/designer/src/lib/shared/qdesigner_utils.cpp
@@ -386,7 +386,7 @@ namespace qdesigner_internal
QPixmap DesignerPixmapCache::pixmap(const PropertySheetPixmapValue &value) const
{
- QMap<PropertySheetPixmapValue, QPixmap>::const_iterator it = m_cache.constFind(value);
+ const auto it = m_cache.constFind(value);
if (it != m_cache.constEnd())
return it.value();
diff --git a/src/designer/src/lib/shared/qdesigner_utils_p.h b/src/designer/src/lib/shared/qdesigner_utils_p.h
index 0743abb29..28db155a5 100644
--- a/src/designer/src/lib/shared/qdesigner_utils_p.h
+++ b/src/designer/src/lib/shared/qdesigner_utils_p.h
@@ -117,7 +117,7 @@ IntType MetaEnum<IntType>::keyToValue(QString key, bool *ok) const
{
if (!m_scope.isEmpty() && key.startsWith(m_scope))
key.remove(0, m_scope.size() + m_separator.size());
- const typename KeyToValueMap::const_iterator it = m_keyToValueMap.find(key);
+ const auto it = m_keyToValueMap.find(key);
const bool found = it != m_keyToValueMap.constEnd();
if (ok)
*ok = found;
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp
index d11d340e2..97775328c 100644
--- a/src/designer/src/lib/shared/qlayout_widget.cpp
+++ b/src/designer/src/lib/shared/qlayout_widget.cpp
@@ -662,14 +662,13 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
void GridLayoutState::applyToLayout(const QDesignerFormEditorInterface *core, QWidget *w) const
{
- using LayoutItemRectMap =QHash<QLayoutItem *, QRect>;
QGridLayout *grid = qobject_cast<QGridLayout *>(LayoutInfo::managedLayout(core, w));
Q_ASSERT(grid);
if (debugLayout)
qDebug() << ">GridLayoutState::applyToLayout" << *this << *grid;
const bool shrink = grid->rowCount() > rowCount || grid->columnCount() > colCount;
// Build a map of existing items to rectangles via widget map, delete spacers
- LayoutItemRectMap itemMap;
+ QHash<QLayoutItem *, QRect> itemMap;
while (grid->count()) {
QLayoutItem *item = grid->takeAt(0);
if (!LayoutInfo::isEmptyItem(item)) {
@@ -689,8 +688,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
grid = static_cast<QGridLayout*>(recreateManagedLayout(core, w, grid));
// Add widgets items
- const LayoutItemRectMap::const_iterator icend = itemMap.constEnd();
- for (LayoutItemRectMap::const_iterator it = itemMap.constBegin(); it != icend; ++it) {
+ for (auto it = itemMap.cbegin(), icend = itemMap.cend(); it != icend; ++it) {
const QRect info = it.value();
const Qt::Alignment alignment = widgetAlignmentMap.value(it.key()->widget(), {});
grid->addItem(it.key(), info.y(), info.x(), info.height(), info.width(), alignment);
diff --git a/src/designer/src/lib/shared/qtresourcemodel.cpp b/src/designer/src/lib/shared/qtresourcemodel.cpp
index 387b76a69..4630bcd56 100644
--- a/src/designer/src/lib/shared/qtresourcemodel.cpp
+++ b/src/designer/src/lib/shared/qtresourcemodel.cpp
@@ -57,8 +57,7 @@ public:
QMap<QString, QList<QtResourceSet *> > m_pathToResourceSet;
QtResourceSet *m_currentResourceSet = nullptr;
- typedef QMap<QString, const QByteArray *> PathDataMap;
- PathDataMap m_pathToData;
+ QMap<QString, const QByteArray *> m_pathToData;
QMap<QString, QStringList> m_pathToContents; // qrc path to its contents.
QMap<QString, QString> m_fileToQrc; // this map contains the content of active resource set only.
@@ -175,7 +174,7 @@ void QtResourceModelPrivate::registerResourceSet(QtResourceSet *resourceSet)
for (const QString &path : toRegister) {
if (debugResourceModel)
qDebug() << "registerResourceSet " << path;
- const PathDataMap::const_iterator itRcc = m_pathToData.constFind(path);
+ const auto itRcc = m_pathToData.constFind(path);
if (itRcc != m_pathToData.constEnd()) { // otherwise data was not created yet
const QByteArray *data = itRcc.value();
if (data) {
@@ -203,7 +202,7 @@ void QtResourceModelPrivate::unregisterResourceSet(QtResourceSet *resourceSet)
for (const QString &path : toUnregister) {
if (debugResourceModel)
qDebug() << "unregisterResourceSet " << path;
- const PathDataMap::const_iterator itRcc = m_pathToData.constFind(path);
+ const auto itRcc = m_pathToData.constFind(path);
if (itRcc != m_pathToData.constEnd()) { // otherwise data was not created yet
const QByteArray *data = itRcc.value();
if (data) {
@@ -234,12 +233,12 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
if (resourceSet && resourceSet->activeResourceFilePaths() != newPaths && !m_newlyCreated.contains(resourceSet))
newResourceSetChanged = true;
- PathDataMap newPathToData = m_pathToData;
+ auto newPathToData = m_pathToData;
for (const QString &path : newPaths) {
if (resourceSet && !m_pathToResourceSet[path].contains(resourceSet))
m_pathToResourceSet[path].append(resourceSet);
- const QMap<QString, bool>::iterator itMod = m_pathToModified.find(path);
+ const auto itMod = m_pathToModified.find(path);
if (itMod == m_pathToModified.end() || itMod.value()) { // new path or path is already created, but needs to be recreated
QStringList contents;
int qrcErrorCount;
@@ -288,7 +287,7 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
*errorMessages = stderrOutput;
}
// register
- const QMap<QtResourceSet *, bool>::iterator itReload = m_resourceSetToReload.find(resourceSet);
+ const auto itReload = m_resourceSetToReload.find(resourceSet);
if (itReload != m_resourceSetToReload.end()) {
if (itReload.value()) {
newResourceSetChanged = true;
@@ -302,7 +301,7 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
const bool needReregister = (oldActivePaths != newPaths) || newResourceSetChanged;
- QMap<QtResourceSet *, bool>::iterator itNew = m_newlyCreated.find(resourceSet);
+ const auto itNew = m_newlyCreated.find(resourceSet);
if (itNew != m_newlyCreated.end()) {
m_newlyCreated.remove(resourceSet);
if (needReregister)
@@ -354,7 +353,7 @@ void QtResourceModelPrivate::removeOldPaths(QtResourceSet *resourceSet, const QS
if (idx >= 0)
itRemove.value().removeAt(idx);
if (itRemove.value().isEmpty()) {
- PathDataMap::iterator it = m_pathToData.find(oldPath);
+ const auto it = m_pathToData.find(oldPath);
if (it != m_pathToData.end())
deleteResource(it.value());
m_pathToResourceSet.erase(itRemove);
@@ -384,7 +383,7 @@ void QtResourceModelPrivate::setWatcherEnabled(const QString &path, bool enable)
void QtResourceModelPrivate::addWatcher(const QString &path)
{
- QMap<QString, bool>::ConstIterator it = m_fileWatchedMap.constFind(path);
+ const auto it = m_fileWatchedMap.constFind(path);
if (it != m_fileWatchedMap.constEnd() && !it.value())
return;
@@ -440,16 +439,12 @@ QStringList QtResourceModel::loadedQrcFiles() const
bool QtResourceModel::isModified(const QString &path) const
{
- QMap<QString, bool>::const_iterator it = d_ptr->m_pathToModified.constFind(path);
- if (it != d_ptr->m_pathToModified.constEnd())
- return it.value();
- return true;
+ return d_ptr->m_pathToModified.value(path, true);
}
void QtResourceModel::setModified(const QString &path)
{
- QMap<QString, bool>::const_iterator itMod = d_ptr->m_pathToModified.constFind(path);
- if (itMod == d_ptr->m_pathToModified.constEnd())
+ if (!d_ptr->m_pathToModified.contains(path))
return;
d_ptr->m_pathToModified[path] = true;
@@ -552,7 +547,7 @@ bool QtResourceModel::isWatcherEnabled() const
void QtResourceModel::setWatcherEnabled(const QString &path, bool enable)
{
- QMap<QString, bool>::Iterator it = d_ptr->m_fileWatchedMap.find(path);
+ const auto it = d_ptr->m_fileWatchedMap.find(path);
if (it == d_ptr->m_fileWatchedMap.end())
return;
diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp
index 66b6bc40b..ef4d8a509 100644
--- a/src/designer/src/lib/shared/qtresourceview.cpp
+++ b/src/designer/src/lib/shared/qtresourceview.cpp
@@ -422,21 +422,18 @@ void QtResourceViewPrivate::filterOutResources()
bool searchForNewPathWithContents = true;
if (!currentPath.isEmpty()) { // if the currentPath is empty we will search for a new path too
- QMap<QString, bool>::ConstIterator it = pathToMatchingContents.constFind(currentPath);
+ const auto it = pathToMatchingContents.constFind(currentPath);
if (it != pathToMatchingContents.constEnd() && it.value()) // the current item has contents, we don't need to search for another path
searchForNewPathWithContents = false;
}
if (searchForNewPathWithContents) {
// we find the first path with the matching contents
- QMap<QString, bool>::ConstIterator itContents = pathToMatchingContents.constBegin();
- while (itContents != pathToMatchingContents.constEnd()) {
+ for (auto itContents = pathToMatchingContents.cbegin(), cend = pathToMatchingContents.cend(); itContents != cend; ++itContents) {
if (itContents.value()) {
newCurrentPath = itContents.key(); // the new path will be activated
break;
}
-
- itContents++;
}
}
diff --git a/src/designer/src/lib/shared/widgetdatabase.cpp b/src/designer/src/lib/shared/widgetdatabase.cpp
index 5f4b770e1..97df98f4d 100644
--- a/src/designer/src/lib/shared/widgetdatabase.cpp
+++ b/src/designer/src/lib/shared/widgetdatabase.cpp
@@ -372,12 +372,9 @@ static WidgetDataBaseItem *createCustomWidgetItem(const QDesignerCustomWidgetInt
void WidgetDataBase::loadPlugins()
{
- typedef QMap<QString, qsizetype> NameIndexMap;
- using ItemList = QList<QDesignerWidgetDataBaseItemInterface *>;
- using NameSet = QSet<QString>;
// 1) create a map of existing custom classes
- NameIndexMap existingCustomClasses;
- NameSet nonCustomClasses;
+ QMap<QString, qsizetype> existingCustomClasses;
+ QSet<QString> nonCustomClasses;
for (qsizetype i = 0, count = m_items.size(); i < count; ++i) {
const QDesignerWidgetDataBaseItemInterface* item = m_items.at(i);
if (item->isCustom() && !item->isPromoted())
@@ -386,7 +383,7 @@ void WidgetDataBase::loadPlugins()
nonCustomClasses.insert(item->name());
}
// 2) create a list plugins
- ItemList pluginList;
+ QList<QDesignerWidgetDataBaseItemInterface *> pluginList;
const QDesignerPluginManager *pm = m_core->pluginManager();
const auto &customWidgets = pm->registeredCustomWidgets();
for (QDesignerCustomWidgetInterface* c : customWidgets)
@@ -400,8 +397,8 @@ void WidgetDataBase::loadPlugins()
if (!pluginList.isEmpty()) {
for (QDesignerWidgetDataBaseItemInterface *pluginItem : std::as_const(pluginList)) {
const QString pluginName = pluginItem->name();
- NameIndexMap::iterator existingIt = existingCustomClasses.find(pluginName);
- if (existingIt == existingCustomClasses.end()) {
+ const auto existingIt = existingCustomClasses.constFind(pluginName);
+ if (existingIt == existingCustomClasses.cend()) {
// Add new class.
if (nonCustomClasses.contains(pluginName)) {
designerWarning(tr("A custom widget plugin whose class name (%1) matches that of an existing class has been found.").arg(pluginName));
@@ -421,16 +418,14 @@ void WidgetDataBase::loadPlugins()
}
}
// 4) remove classes that have not been matched. The stored indexes become invalid while deleting.
- if (!existingCustomClasses.isEmpty()) {
- NameIndexMap::const_iterator cend = existingCustomClasses.constEnd();
- for (NameIndexMap::const_iterator it = existingCustomClasses.constBegin();it != cend; ++it ) {
- const int index = indexOfClassName(it.key());
- if (index != -1) {
- remove(index);
- removedPlugins++;
- }
+ for (auto it = existingCustomClasses.cbegin(), cend = existingCustomClasses.cend(); it != cend; ++it ) {
+ const int index = indexOfClassName(it.key());
+ if (index != -1) {
+ remove(index);
+ removedPlugins++;
}
}
+
if (debugWidgetDataBase)
qDebug() << "WidgetDataBase::loadPlugins(): " << addedPlugins << " added, " << replacedPlugins << " replaced, " << removedPlugins << "deleted.";
}
@@ -560,8 +555,6 @@ QStringList WidgetDataBase::customFormWidgetClasses(const QDesignerFormEditorInt
// properties to be suitable for new forms
static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const QString &className, const QString &objectName)
{
- using PropertyList = QList<DomProperty *>;
-
QDesignerWidgetBoxInterface::Widget widget;
const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
if (!found)
@@ -575,8 +568,8 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const
return QString();
// Properties: Remove the "objectName" property in favour of the name attribute and check geometry.
domWidget->setAttributeName(objectName);
- PropertyList properties = domWidget->elementProperty();
- for (PropertyList::iterator it = properties.begin(); it != properties.end(); ) {
+ QList<DomProperty *> properties = domWidget->elementProperty();
+ for (auto it = properties.begin(); it != properties.end(); ) {
DomProperty *property = *it;
if (property->attributeName() == "objectName"_L1) { // remove "objectName"
it = properties.erase(it);
diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp
index 413cac53a..086cffa16 100644
--- a/src/designer/src/lib/shared/widgetfactory.cpp
+++ b/src/designer/src/lib/shared/widgetfactory.cpp
@@ -295,11 +295,11 @@ static bool classNameMatches(const QObject *created, const QString &className)
QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *parentWidget, bool *creationError) const
{
*creationError = false;
- CustomWidgetFactoryMap::const_iterator it = m_customFactory.constFind(className);
- if (it == m_customFactory.constEnd())
+
+ auto *factory = m_customFactory.value(className, nullptr);
+ if (factory == nullptr)
return nullptr;
- QDesignerCustomWidgetInterface *factory = it.value();
QWidget *rc = factory->createWidget(parentWidget);
// shouldn't happen
if (!rc) {
@@ -768,7 +768,7 @@ QStyle *WidgetFactory::getStyle(const QString &styleName)
if (isApplicationStyle(styleName))
return qApp->style();
- StyleCache::iterator it = m_styleCache.find(styleName);
+ auto it = m_styleCache.find(styleName);
if (it == m_styleCache.end()) {
QStyle *style = QStyleFactory::create(styleName);
if (!style) {
diff --git a/src/designer/src/lib/shared/widgetfactory_p.h b/src/designer/src/lib/shared/widgetfactory_p.h
index 475f027e9..e4e76c3c5 100644
--- a/src/designer/src/lib/shared/widgetfactory_p.h
+++ b/src/designer/src/lib/shared/widgetfactory_p.h
@@ -129,14 +129,12 @@ private:
const Strings m_strings;
QDesignerFormEditorInterface *m_core;
- using CustomWidgetFactoryMap = QMap<QString, QDesignerCustomWidgetInterface*>;
- CustomWidgetFactoryMap m_customFactory;
+ QMap<QString, QDesignerCustomWidgetInterface *> m_customFactory;
QDesignerFormWindowInterface *m_formWindow;
// Points to the cached style or 0 if the default (qApp) is active
QStyle *m_currentStyle;
- using StyleCache = QHash<QString, QStyle *>;
- StyleCache m_styleCache;
+ QHash<QString, QStyle *> m_styleCache;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index cd675dcf9..49c5a116a 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -154,8 +154,6 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
*/
QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
{
- using ButtonGroupHash = QFormBuilderExtra::ButtonGroupHash;
-
d->clear();
if (const DomLayoutDefault *def = ui->elementLayoutDefault()) {
d->m_defaultMargin = def->hasAttributeMargin() ? def->attributeMargin() : INT_MIN;
@@ -173,12 +171,9 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
if (QWidget *widget = create(ui_widget, parentWidget)) {
// Reparent button groups that were actually created to main container for them to be found in the signal/slot part
- const ButtonGroupHash &buttonGroups = d->buttonGroups();
- if (!buttonGroups.isEmpty()) {
- const ButtonGroupHash::const_iterator cend = buttonGroups.constEnd();
- for (ButtonGroupHash::const_iterator it = buttonGroups.constBegin(); it != cend; ++it)
- if (it.value().second)
- it.value().second->setParent(widget);
+ for (const auto &bg : std::as_const(d->buttonGroups())) {
+ if (bg.second)
+ bg.second->setParent(widget);
}
createConnections(ui->elementConnections(), widget);
createResources(ui->elementResources()); // maybe this should go first, before create()...
@@ -2244,7 +2239,7 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst
return;
// Find entry
ButtonGroupHash &buttonGroups = d->buttonGroups();
- ButtonGroupHash::iterator it = buttonGroups.find(groupName);
+ const auto it = buttonGroups.find(groupName);
if (it == buttonGroups.end()) {
#ifdef QFORMINTERNAL_NAMESPACE // Suppress the warning when copying in Designer
uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid QButtonGroup reference '%1' referenced by '%2'.").arg(groupName, button->objectName()));
diff --git a/src/designer/src/lib/uilib/formbuilderextra.cpp b/src/designer/src/lib/uilib/formbuilderextra.cpp
index a05d988a1..c8ab290bc 100644
--- a/src/designer/src/lib/uilib/formbuilderextra.cpp
+++ b/src/designer/src/lib/uilib/formbuilderextra.cpp
@@ -161,11 +161,7 @@ bool QFormBuilderExtra::applyPropertyInternally(QObject *o, const QString &prope
void QFormBuilderExtra::applyInternalProperties() const
{
- if (m_buddies.isEmpty())
- return;
-
- const BuddyHash::const_iterator cend = m_buddies.constEnd();
- for (BuddyHash::const_iterator it = m_buddies.constBegin(); it != cend; ++it )
+ for (auto it = m_buddies.cbegin(), cend = m_buddies.cend(); it != cend; ++it )
applyBuddy(it.value(), BuddyApplyAll, it.key());
}
@@ -218,15 +214,15 @@ void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const Do
QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
- return it.value().baseClass;
+ return it.value().baseClass;
return QString();
}
QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
return it.value().addPageMethod;
return QString();
@@ -234,7 +230,7 @@ QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) c
bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
return it.value().isContainer;
return false;
diff --git a/src/designer/src/lib/uilib/formbuilderextra_p.h b/src/designer/src/lib/uilib/formbuilderextra_p.h
index a09d68356..aa3cd10b1 100644
--- a/src/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/src/designer/src/lib/uilib/formbuilderextra_p.h
@@ -161,8 +161,7 @@ private:
void clearResourceBuilder();
void clearTextBuilder();
- using BuddyHash = QHash<QLabel*, QString>;
- BuddyHash m_buddies;
+ QHash<QLabel *, QString> m_buddies;
QHash<QString, CustomWidgetData> m_customWidgetDataHash;
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
index 9c75af8b0..637369604 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
+++ b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
@@ -67,7 +67,7 @@ QDesignerAxWidget *QAxWidgetPropertySheet::axWidget() const
bool QAxWidgetPropertySheet::reset(int index)
{
const QString name = propertyName(index);
- QMap<QString, QVariant>::iterator it = m_currentProperties.changedProperties.find(name);
+ const auto it = m_currentProperties.changedProperties.find(name);
if (it != m_currentProperties.changedProperties.end())
m_currentProperties.changedProperties.erase(it);
if (name != m_controlProperty)
diff --git a/src/designer/src/plugins/tools/view3d/view3d.cpp b/src/designer/src/plugins/tools/view3d/view3d.cpp
index f280151a3..38df72afd 100644
--- a/src/designer/src/plugins/tools/view3d/view3d.cpp
+++ b/src/designer/src/plugins/tools/view3d/view3d.cpp
@@ -127,7 +127,7 @@ void QView3DWidget::addTexture(QWidget *w, const QPixmap &pm)
void QView3DWidget::addWidget(int depth, QWidget *widget)
{
- TextureMap::const_iterator it = m_texture_map.find(widget);
+ const auto it = m_texture_map.find(widget);
Q_ASSERT(it != m_texture_map.end());
makeCurrent();
@@ -163,7 +163,7 @@ void QView3DWidget::clear()
{
makeCurrent();
glDeleteLists(m_form_list_id, 1);
- for (TextureMap::iterator it = m_texture_map.begin(), end = m_texture_map.end(); it != end; ++it)
+ for (auto it = m_texture_map.begin(), end = m_texture_map.end(); it != end; ++it)
glDeleteTextures(1, &(it.value()));
m_texture_map.clear();
m_widget_name_map.clear();
diff --git a/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp b/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp
index 6f9b86bfa..734a33d09 100644
--- a/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp
+++ b/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp
@@ -162,25 +162,16 @@ void QtGradientStopsControllerPrivate::enableCurrent(bool enable)
QtGradientStopsControllerPrivate::PositionColorMap QtGradientStopsControllerPrivate::stopsData(const PositionStopMap &stops) const
{
PositionColorMap data;
- PositionStopMap::ConstIterator itStop = stops.constBegin();
- while (itStop != stops.constEnd()) {
- QtGradientStop *stop = itStop.value();
+ for (QtGradientStop *stop : stops)
data[stop->position()] = stop->color();
-
- ++itStop;
- }
return data;
}
QGradientStops QtGradientStopsControllerPrivate::makeGradientStops(const PositionColorMap &data) const
{
QGradientStops stops;
- PositionColorMap::ConstIterator itData = data.constBegin();
- while (itData != data.constEnd()) {
+ for (auto itData = data.cbegin(), cend = data.cend(); itData != cend; ++itData)
stops << QPair<qreal, QColor>(itData.key(), itData.value());
-
- ++itData;
- }
return stops;
}
diff --git a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp
index 440593936..32924a067 100644
--- a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp
+++ b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp
@@ -97,7 +97,7 @@ QColor QtGradientStopsModel::color(qreal pos) const
return gradStops[pos]->color();
gradStops[pos] = 0;
- PositionStopMap::ConstIterator itStop = gradStops.constFind(pos);
+ auto itStop = gradStops.constFind(pos);
if (itStop == gradStops.constBegin()) {
++itStop;
return itStop.value()->color();
@@ -106,8 +106,8 @@ QColor QtGradientStopsModel::color(qreal pos) const
--itStop;
return itStop.value()->color();
}
- PositionStopMap::ConstIterator itPrev = itStop;
- PositionStopMap::ConstIterator itNext = itStop;
+ auto itPrev = itStop;
+ auto itNext = itStop;
--itPrev;
++itNext;
@@ -265,7 +265,7 @@ void QtGradientStopsModel::setCurrentStop(QtGradientStop *stop)
QtGradientStop *QtGradientStopsModel::firstSelected() const
{
PositionStopMap stopList = stops();
- PositionStopMap::ConstIterator itStop = stopList.constBegin();
+ auto itStop = stopList.cbegin();
while (itStop != stopList.constEnd()) {
QtGradientStop *stop = itStop.value();
if (isSelected(stop))
@@ -278,7 +278,7 @@ QtGradientStop *QtGradientStopsModel::firstSelected() const
QtGradientStop *QtGradientStopsModel::lastSelected() const
{
PositionStopMap stopList = stops();
- PositionStopMap::ConstIterator itStop = stopList.constEnd();
+ auto itStop = stopList.cend();
while (itStop != stopList.constBegin()) {
--itStop;
@@ -344,7 +344,7 @@ void QtGradientStopsModel::moveStops(double newPosition)
stopList[stop->position()] = stop;
stopList[current->position()] = current;
- PositionStopMap::ConstIterator itStop = forward ? stopList.constBegin() : stopList.constEnd();
+ auto itStop = forward ? stopList.cbegin() : stopList.cend();
while (itStop != (forward ? stopList.constEnd() : stopList.constBegin())) {
if (!forward)
--itStop;
diff --git a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp
index 5be4aa87a..afa57ff30 100644
--- a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp
+++ b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp
@@ -452,7 +452,7 @@ void QtGradientStopsWidget::mousePressEvent(QMouseEvent *e)
QtGradientStop *oldCurrent = d_ptr->m_model->currentStop();
if (oldCurrent) {
PositionStopMap stops = d_ptr->m_model->stops();
- PositionStopMap::ConstIterator itSt = stops.constFind(oldCurrent->position());
+ auto itSt = stops.constFind(oldCurrent->position());
if (itSt != stops.constEnd()) {
while (itSt != stops.constFind(stop->position())) {
d_ptr->m_model->selectStop(itSt.value(), true);
@@ -495,9 +495,6 @@ void QtGradientStopsWidget::mouseReleaseEvent(QMouseEvent *e)
void QtGradientStopsWidget::mouseMoveEvent(QMouseEvent *e)
{
- typedef QtGradientStopsWidgetPrivate::PositionColorMap PositionColorMap;
- typedef QtGradientStopsModel::PositionStopMap PositionStopMap;
- typedef QtGradientStopsWidgetPrivate::StopPositionMap StopPositionMap;
if (!d_ptr->m_model)
return;
@@ -511,7 +508,7 @@ void QtGradientStopsWidget::mouseMoveEvent(QMouseEvent *e)
double maxOffset = 0.0;
double minOffset = 0.0;
bool first = true;
- StopPositionMap::ConstIterator itStop = d_ptr->m_moveStops.constBegin();
+ auto itStop = d_ptr->m_moveStops.cbegin();
while (itStop != d_ptr->m_moveStops.constEnd()) {
double offset = itStop.value();
@@ -531,7 +528,7 @@ void QtGradientStopsWidget::mouseMoveEvent(QMouseEvent *e)
double viewportMin = d_ptr->toViewport(-minOffset);
double viewportMax = d_ptr->toViewport(1.0 - maxOffset);
- PositionStopMap newPositions;
+ QtGradientStopsModel::PositionStopMap newPositions;
int viewportX = e->position().toPoint().x() - d_ptr->m_moveOffset;
@@ -557,7 +554,7 @@ void QtGradientStopsWidget::mouseMoveEvent(QMouseEvent *e)
}
bool forward = true;
- PositionStopMap::ConstIterator itNewPos = newPositions.constBegin();
+ auto itNewPos = newPositions.cbegin();
if (itNewPos.value()->position() < itNewPos.key())
forward = false;
@@ -581,7 +578,7 @@ void QtGradientStopsWidget::mouseMoveEvent(QMouseEvent *e)
++itNewPos;
}
- PositionColorMap::ConstIterator itOld = d_ptr->m_moveOriginal.constBegin();
+ auto itOld = d_ptr->m_moveOriginal.cbegin();
while (itOld != d_ptr->m_moveOriginal.constEnd()) {
double position = itOld.key();
if (!d_ptr->m_model->at(position))
@@ -690,7 +687,7 @@ void QtGradientStopsWidget::keyPressEvent(QKeyEvent *e)
else if (e->key() == Qt::Key_Right || e->key() == Qt::Key_End)
newCurrent = (--stops.constEnd()).value();
} else {
- PositionStopMap::ConstIterator itStop = stops.constBegin();
+ auto itStop = stops.cbegin();
while (itStop.value() != current)
++itStop;
if (e->key() == Qt::Key_Left && itStop != stops.constBegin())
diff --git a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp
index 20276fa7a..c5e23528f 100644
--- a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp
+++ b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp
@@ -516,8 +516,7 @@ QtButtonPropertyBrowser::QtButtonPropertyBrowser(QWidget *parent)
*/
QtButtonPropertyBrowser::~QtButtonPropertyBrowser()
{
- const QMap<QtButtonPropertyBrowserPrivate::WidgetItem *, QtBrowserItem *>::ConstIterator icend = d_ptr->m_itemToIndex.constEnd();
- for (QMap<QtButtonPropertyBrowserPrivate::WidgetItem *, QtBrowserItem *>::ConstIterator it = d_ptr->m_itemToIndex.constBegin(); it != icend; ++it)
+ for (auto it = d_ptr->m_itemToIndex.cbegin(), icend = d_ptr->m_itemToIndex.cend(); it != icend; ++it)
delete it.key();
}
diff --git a/src/shared/qtpropertybrowser/qteditorfactory.cpp b/src/shared/qtpropertybrowser/qteditorfactory.cpp
index 0954d61c2..b1c973175 100644
--- a/src/shared/qtpropertybrowser/qteditorfactory.cpp
+++ b/src/shared/qtpropertybrowser/qteditorfactory.cpp
@@ -161,8 +161,7 @@ void QtSpinBoxFactoryPrivate::slotSingleStepChanged(QtProperty *property, int st
void QtSpinBoxFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
- const QMap<QSpinBox *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QSpinBox *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor) {
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
@@ -313,8 +312,7 @@ void QtSliderFactoryPrivate::slotSingleStepChanged(QtProperty *property, int ste
void QtSliderFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
- const QMap<QSlider *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QSlider *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor ) {
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor ) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
@@ -466,8 +464,7 @@ void QtScrollBarFactoryPrivate::slotSingleStepChanged(QtProperty *property, int
void QtScrollBarFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
- const QMap<QScrollBar *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QScrollBar *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
@@ -586,8 +583,7 @@ void QtCheckBoxFactoryPrivate::slotSetValue(bool value)
{
QObject *object = q_ptr->sender();
- const QMap<QtBoolEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QtBoolEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtBoolPropertyManager *manager = q_ptr->propertyManager(property);
@@ -754,8 +750,7 @@ void QtDoubleSpinBoxFactoryPrivate::slotDecimalsChanged(QtProperty *property, in
void QtDoubleSpinBoxFactoryPrivate::slotSetValue(double value)
{
QObject *object = q_ptr->sender();
- const QMap<QDoubleSpinBox *, QtProperty *>::ConstIterator itcend = m_editorToProperty.constEnd();
- for (QMap<QDoubleSpinBox *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != itcend; ++itEditor) {
+ for (auto itEditor = m_editorToProperty.cbegin(), itcend = m_editorToProperty.cend(); itEditor != itcend; ++itEditor) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtDoublePropertyManager *manager = q_ptr->propertyManager(property);
@@ -906,8 +901,7 @@ void QtLineEditFactoryPrivate::slotRegExpChanged(QtProperty *property,
void QtLineEditFactoryPrivate::slotSetValue(const QString &value)
{
QObject *object = q_ptr->sender();
- const QMap<QLineEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QLineEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtStringPropertyManager *manager = q_ptr->propertyManager(property);
@@ -1043,8 +1037,7 @@ void QtDateEditFactoryPrivate::slotRangeChanged(QtProperty *property, QDate min,
void QtDateEditFactoryPrivate::slotSetValue(QDate value)
{
QObject *object = q_ptr->sender();
- const QMap<QDateEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QDateEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtDatePropertyManager *manager = q_ptr->propertyManager(property);
@@ -1159,8 +1152,7 @@ void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, QTime v
void QtTimeEditFactoryPrivate::slotSetValue(QTime value)
{
QObject *object = q_ptr->sender();
- const QMap<QTimeEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QTimeEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtTimePropertyManager *manager = q_ptr->propertyManager(property);
@@ -1272,8 +1264,7 @@ void QtDateTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property,
void QtDateTimeEditFactoryPrivate::slotSetValue(const QDateTime &value)
{
QObject *object = q_ptr->sender();
- const QMap<QDateTimeEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QDateTimeEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtDateTimePropertyManager *manager = q_ptr->propertyManager(property);
@@ -1384,8 +1375,7 @@ void QtKeySequenceEditorFactoryPrivate::slotPropertyChanged(QtProperty *property
void QtKeySequenceEditorFactoryPrivate::slotSetValue(const QKeySequence &value)
{
QObject *object = q_ptr->sender();
- const QMap<QKeySequenceEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QKeySequenceEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtKeySequencePropertyManager *manager = q_ptr->propertyManager(property);
@@ -1663,8 +1653,7 @@ void QtCharEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
void QtCharEditorFactoryPrivate::slotSetValue(const QChar &value)
{
QObject *object = q_ptr->sender();
- const QMap<QtCharEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QtCharEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtCharPropertyManager *manager = q_ptr->propertyManager(property);
@@ -1822,8 +1811,7 @@ void QtEnumEditorFactoryPrivate::slotEnumIconsChanged(QtProperty *property,
void QtEnumEditorFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
- const QMap<QComboBox *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
- for (QMap<QComboBox *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtEnumPropertyManager *manager = q_ptr->propertyManager(property);
@@ -1980,8 +1968,7 @@ void QtCursorEditorFactoryPrivate::slotEditorDestroyed(QObject *object)
// remove from m_editorToEnum map;
// remove from m_enumToEditors map;
// if m_enumToEditors doesn't contains more editors delete enum property;
- const QMap<QWidget *, QtProperty *>::ConstIterator ecend = m_editorToEnum.constEnd();
- for (QMap<QWidget *, QtProperty *>::ConstIterator itEditor = m_editorToEnum.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToEnum.cbegin(), ecend = m_editorToEnum.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QWidget *editor = itEditor.key();
QtProperty *enumProp = itEditor.value();
@@ -2205,8 +2192,7 @@ void QtColorEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
void QtColorEditorFactoryPrivate::slotSetValue(const QColor &value)
{
QObject *object = q_ptr->sender();
- const EditorToPropertyMap::ConstIterator ecend = m_editorToProperty.constEnd();
- for (EditorToPropertyMap::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtColorPropertyManager *manager = q_ptr->propertyManager(property);
@@ -2420,8 +2406,7 @@ void QtFontEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
void QtFontEditorFactoryPrivate::slotSetValue(const QFont &value)
{
QObject *object = q_ptr->sender();
- const EditorToPropertyMap::ConstIterator ecend = m_editorToProperty.constEnd();
- for (EditorToPropertyMap::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
+ for (auto itEditor = m_editorToProperty.cbegin(), ecend = m_editorToProperty.cend(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtFontPropertyManager *manager = q_ptr->propertyManager(property);
diff --git a/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp
index 9d1cb562d..d30a41348 100644
--- a/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp
+++ b/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp
@@ -301,8 +301,7 @@ void QtGroupBoxPropertyBrowserPrivate::insertRow(QGridLayout *layout, int row) c
}
}
- const QMap<QLayoutItem *, QRect>::ConstIterator icend = itemToPos.constEnd();
- for (QMap<QLayoutItem *, QRect>::ConstIterator it = itemToPos.constBegin(); it != icend; ++it) {
+ for (auto it = itemToPos.cbegin(), icend = itemToPos.cend(); it != icend; ++it) {
const QRect r = it.value();
layout->addItem(it.key(), r.x(), r.y(), r.width(), r.height());
}
@@ -322,8 +321,7 @@ void QtGroupBoxPropertyBrowserPrivate::removeRow(QGridLayout *layout, int row) c
}
}
- const QMap<QLayoutItem *, QRect>::ConstIterator icend = itemToPos.constEnd();
- for (QMap<QLayoutItem *, QRect>::ConstIterator it = itemToPos.constBegin(); it != icend; ++it) {
+ for (auto it = itemToPos.cbegin(), icend = itemToPos.cend(); it != icend; ++it) {
const QRect r = it.value();
layout->addItem(it.key(), r.x(), r.y(), r.width(), r.height());
}
@@ -436,8 +434,7 @@ QtGroupBoxPropertyBrowser::QtGroupBoxPropertyBrowser(QWidget *parent)
*/
QtGroupBoxPropertyBrowser::~QtGroupBoxPropertyBrowser()
{
- const QMap<QtGroupBoxPropertyBrowserPrivate::WidgetItem *, QtBrowserItem *>::ConstIterator icend = d_ptr->m_itemToIndex.constEnd();
- for (QMap<QtGroupBoxPropertyBrowserPrivate::WidgetItem *, QtBrowserItem *>::ConstIterator it = d_ptr->m_itemToIndex.constBegin(); it != icend; ++it)
+ for (auto it = d_ptr->m_itemToIndex.cbegin(), icend = d_ptr->m_itemToIndex.cend(); it != icend; ++it)
delete it.key();
}
diff --git a/src/shared/qtpropertybrowser/qtpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtpropertybrowser.cpp
index bb432349e..9fe3ab77d 100644
--- a/src/shared/qtpropertybrowser/qtpropertybrowser.cpp
+++ b/src/shared/qtpropertybrowser/qtpropertybrowser.cpp
@@ -1301,8 +1301,7 @@ void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(QtProperty *property
parentToAfter[nullptr] = nullptr;
}
- const QMap<QtBrowserItem *, QtBrowserItem *>::ConstIterator pcend = parentToAfter.constEnd();
- for (QMap<QtBrowserItem *, QtBrowserItem *>::ConstIterator it = parentToAfter.constBegin(); it != pcend; ++it)
+ for (auto it = parentToAfter.cbegin(), pcend = parentToAfter.cend(); it != pcend; ++it)
createBrowserIndex(property, it.key(), it.value());
}
diff --git a/src/shared/qttoolbardialog/qttoolbardialog.cpp b/src/shared/qttoolbardialog/qttoolbardialog.cpp
index 547a6cab3..e11f4ae93 100644
--- a/src/shared/qttoolbardialog/qttoolbardialog.cpp
+++ b/src/shared/qttoolbardialog/qttoolbardialog.cpp
@@ -426,10 +426,7 @@ QList<QAction *> QtFullToolBarManager::categoryActions(const QString &category)
QString QtFullToolBarManager::actionCategory(QAction *action) const
{
- QMap<QAction *, QString>::ConstIterator it = d_ptr->actionToCategory.find(action);
- if (it != d_ptr->actionToCategory.constEnd())
- return it.value();
- return QString();
+ return d_ptr->actionToCategory.value(action, {});
}
void QtFullToolBarManager::addAction(QAction *action, const QString &category)