diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-11-03 10:18:54 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-11-03 14:01:49 +0000 |
commit | ac6b24246a0097eb77baccb55f23efbe4a38979a (patch) | |
tree | 7f0ee1adcc4b258f63c7192629b34cfc631a6543 /src/shared | |
parent | 116cb4e1b339cb092afd892d43d959c2de92f857 (diff) |
Qt Designer/Property browser: Remove use of Java-style iterators
Use range-based for or STL style iterators instead.
Change-Id: Ie0c1d65b380b63470681a433ffc5d6be89ab3d4c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp | 9 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qteditorfactory.cpp | 203 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp | 5 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertybrowser.cpp | 100 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertybrowser.h | 16 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertymanager.cpp | 69 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qttreepropertybrowser.cpp | 11 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtvariantproperty.cpp | 373 |
8 files changed, 318 insertions, 468 deletions
diff --git a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp index cf0fc1a19..144d7bee0 100644 --- a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp +++ b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp @@ -123,9 +123,7 @@ int QtButtonPropertyBrowserPrivate::gridRow(WidgetItem *item) const siblings = m_children; int row = 0; - QListIterator<WidgetItem *> it(siblings); - while (it.hasNext()) { - WidgetItem *sibling = it.next(); + for (WidgetItem *sibling : qAsConst(siblings)) { if (sibling == item) return row; row += gridSpan(sibling); @@ -162,10 +160,7 @@ void QtButtonPropertyBrowserPrivate::slotEditorDestroyed() void QtButtonPropertyBrowserPrivate::slotUpdate() { - QListIterator<WidgetItem *> itItem(m_recreateQueue); - while (itItem.hasNext()) { - WidgetItem *item = itItem.next(); - + for (WidgetItem *item : qAsConst(m_recreateQueue)) { WidgetItem *parent = item->parent; QWidget *w = 0; QGridLayout *l = 0; diff --git a/src/shared/qtpropertybrowser/qteditorfactory.cpp b/src/shared/qtpropertybrowser/qteditorfactory.cpp index 36414b668..a87449faf 100644 --- a/src/shared/qtpropertybrowser/qteditorfactory.cpp +++ b/src/shared/qtpropertybrowser/qteditorfactory.cpp @@ -149,11 +149,10 @@ public: void QtSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, int value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QSpinBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QSpinBox *editor = itEditor.next(); + for (QSpinBox *editor : it.value()) { if (editor->value() != value) { editor->blockSignals(true); editor->setValue(value); @@ -164,16 +163,15 @@ void QtSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, int valu void QtSpinBoxFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int max) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; QtIntPropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QListIterator<QSpinBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QSpinBox *editor = itEditor.next(); + for (QSpinBox *editor : it.value()) { editor->blockSignals(true); editor->setRange(min, max); editor->setValue(manager->value(property)); @@ -183,11 +181,10 @@ void QtSpinBoxFactoryPrivate::slotRangeChanged(QtProperty *property, int min, in void QtSpinBoxFactoryPrivate::slotSingleStepChanged(QtProperty *property, int step) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QSpinBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QSpinBox *editor = itEditor.next(); + for (QSpinBox *editor : it.value()) { editor->blockSignals(true); editor->setSingleStep(step); editor->blockSignals(false); @@ -305,11 +302,10 @@ public: void QtSliderFactoryPrivate::slotPropertyChanged(QtProperty *property, int value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QSlider *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QSlider *editor = itEditor.next(); + for (QSlider *editor : it.value()) { editor->blockSignals(true); editor->setValue(value); editor->blockSignals(false); @@ -318,16 +314,15 @@ void QtSliderFactoryPrivate::slotPropertyChanged(QtProperty *property, int value void QtSliderFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int max) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; QtIntPropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QListIterator<QSlider *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QSlider *editor = itEditor.next(); + for (QSlider *editor : it.value()) { editor->blockSignals(true); editor->setRange(min, max); editor->setValue(manager->value(property)); @@ -337,11 +332,10 @@ void QtSliderFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int void QtSliderFactoryPrivate::slotSingleStepChanged(QtProperty *property, int step) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QSlider *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QSlider *editor = itEditor.next(); + for (QSlider *editor : it.value()) { editor->blockSignals(true); editor->setSingleStep(step); editor->blockSignals(false); @@ -459,12 +453,11 @@ public: void QtScrollBarFactoryPrivate::slotPropertyChanged(QtProperty *property, int value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QScrollBar *> itEditor( m_createdEditors[property]); - while (itEditor.hasNext()) { - QScrollBar *editor = itEditor.next(); + for (QScrollBar *editor : it.value()) { editor->blockSignals(true); editor->setValue(value); editor->blockSignals(false); @@ -473,16 +466,15 @@ void QtScrollBarFactoryPrivate::slotPropertyChanged(QtProperty *property, int va void QtScrollBarFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int max) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; QtIntPropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QListIterator<QScrollBar *> itEditor( m_createdEditors[property]); - while (itEditor.hasNext()) { - QScrollBar *editor = itEditor.next(); + for (QScrollBar *editor : it.value()) { editor->blockSignals(true); editor->setRange(min, max); editor->setValue(manager->value(property)); @@ -492,11 +484,10 @@ void QtScrollBarFactoryPrivate::slotRangeChanged(QtProperty *property, int min, void QtScrollBarFactoryPrivate::slotSingleStepChanged(QtProperty *property, int step) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QScrollBar *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QScrollBar *editor = itEditor.next(); + for (QScrollBar *editor : it.value()) { editor->blockSignals(true); editor->setSingleStep(step); editor->blockSignals(false); @@ -610,12 +601,11 @@ public: void QtCheckBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, bool value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; - QListIterator<QtBoolEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QtBoolEdit *editor = itEditor.next(); + for (QtBoolEdit *editor : it.value()) { editor->blockCheckBoxSignals(true); editor->setChecked(value); editor->blockCheckBoxSignals(false); @@ -724,10 +714,10 @@ public: void QtDoubleSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, double value) { - QList<QDoubleSpinBox *> editors = m_createdEditors[property]; - QListIterator<QDoubleSpinBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QDoubleSpinBox *editor = itEditor.next(); + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) + return; + for (QDoubleSpinBox *editor : it.value()) { if (editor->value() != value) { editor->blockSignals(true); editor->setValue(value); @@ -739,17 +729,15 @@ void QtDoubleSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, do void QtDoubleSpinBoxFactoryPrivate::slotRangeChanged(QtProperty *property, double min, double max) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; QtDoublePropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QList<QDoubleSpinBox *> editors = m_createdEditors[property]; - QListIterator<QDoubleSpinBox *> itEditor(editors); - while (itEditor.hasNext()) { - QDoubleSpinBox *editor = itEditor.next(); + for (QDoubleSpinBox *editor : it.value()) { editor->blockSignals(true); editor->setRange(min, max); editor->setValue(manager->value(property)); @@ -759,17 +747,15 @@ void QtDoubleSpinBoxFactoryPrivate::slotRangeChanged(QtProperty *property, void QtDoubleSpinBoxFactoryPrivate::slotSingleStepChanged(QtProperty *property, double step) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.cend()) return; QtDoublePropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QList<QDoubleSpinBox *> editors = m_createdEditors[property]; - QListIterator<QDoubleSpinBox *> itEditor(editors); - while (itEditor.hasNext()) { - QDoubleSpinBox *editor = itEditor.next(); + for (QDoubleSpinBox *editor : it.value()) { editor->blockSignals(true); editor->setSingleStep(step); editor->blockSignals(false); @@ -778,17 +764,15 @@ void QtDoubleSpinBoxFactoryPrivate::slotSingleStepChanged(QtProperty *property, void QtDoubleSpinBoxFactoryPrivate::slotDecimalsChanged(QtProperty *property, int prec) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; QtDoublePropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QList<QDoubleSpinBox *> editors = m_createdEditors[property]; - QListIterator<QDoubleSpinBox *> itEditor(editors); - while (itEditor.hasNext()) { - QDoubleSpinBox *editor = itEditor.next(); + for (QDoubleSpinBox *editor : it.value()) { editor->blockSignals(true); editor->setDecimals(prec); editor->setValue(manager->value(property)); @@ -912,12 +896,11 @@ public: void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QString &value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QLineEdit *> itEditor( m_createdEditors[property]); - while (itEditor.hasNext()) { - QLineEdit *editor = itEditor.next(); + for (QLineEdit *editor : it.value()) { if (editor->text() != value) editor->setText(value); } @@ -926,16 +909,15 @@ void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property, void QtLineEditFactoryPrivate::slotRegExpChanged(QtProperty *property, const QRegExp ®Exp) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; QtStringPropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QListIterator<QLineEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QLineEdit *editor = itEditor.next(); + for (QLineEdit *editor : it.value()) { editor->blockSignals(true); const QValidator *oldValidator = editor->validator(); QValidator *newValidator = 0; @@ -1059,11 +1041,10 @@ public: void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QDate &value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QDateEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QDateEdit *editor = itEditor.next(); + for (QDateEdit *editor : it.value()) { editor->blockSignals(true); editor->setDate(value); editor->blockSignals(false); @@ -1073,16 +1054,15 @@ void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const Q void QtDateEditFactoryPrivate::slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; QtDatePropertyManager *manager = q_ptr->propertyManager(property); if (!manager) return; - QListIterator<QDateEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QDateEdit *editor = itEditor.next(); + for (QDateEdit *editor : it.value()) { editor->blockSignals(true); editor->setDateRange(min, max); editor->setDate(manager->value(property)); @@ -1196,11 +1176,10 @@ public: void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QTime &value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QTimeEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QTimeEdit *editor = itEditor.next(); + for (QTimeEdit *editor : it.value()) { editor->blockSignals(true); editor->setTime(value); editor->blockSignals(false); @@ -1309,12 +1288,11 @@ public: void QtDateTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QDateTime &value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QDateTimeEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QDateTimeEdit *editor = itEditor.next(); + for (QDateTimeEdit *editor : it.value()) { editor->blockSignals(true); editor->setDateTime(value); editor->blockSignals(false); @@ -1422,12 +1400,11 @@ public: void QtKeySequenceEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, const QKeySequence &value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QKeySequenceEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QKeySequenceEdit *editor = itEditor.next(); + for (QKeySequenceEdit *editor : it.value()) { editor->blockSignals(true); editor->setKeySequence(value); editor->blockSignals(false); @@ -1566,10 +1543,8 @@ bool QtCharEdit::eventFilter(QObject *o, QEvent *e) if (o == m_lineEdit && e->type() == QEvent::ContextMenu) { QContextMenuEvent *c = static_cast<QContextMenuEvent *>(e); QMenu *menu = m_lineEdit->createStandardContextMenu(); - QList<QAction *> actions = menu->actions(); - QListIterator<QAction *> itAction(actions); - while (itAction.hasNext()) { - QAction *action = itAction.next(); + const QList<QAction *> actions = menu->actions(); + for (QAction *action : actions) { action->setShortcut(QKeySequence()); QString actionString = action->text(); const int pos = actionString.lastIndexOf(QLatin1Char('\t')); @@ -1704,12 +1679,11 @@ public: void QtCharEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, const QChar &value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QtCharEdit *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QtCharEdit *editor = itEditor.next(); + for (QtCharEdit *editor : it.value()) { editor->blockSignals(true); editor->setValue(value); editor->blockSignals(false); @@ -1817,12 +1791,11 @@ public: void QtEnumEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, int value) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QComboBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QComboBox *editor = itEditor.next(); + for (QComboBox *editor : it.value()) { editor->blockSignals(true); editor->setCurrentIndex(value); editor->blockSignals(false); @@ -1832,7 +1805,8 @@ void QtEnumEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, int v void QtEnumEditorFactoryPrivate::slotEnumNamesChanged(QtProperty *property, const QStringList &enumNames) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; QtEnumPropertyManager *manager = q_ptr->propertyManager(property); @@ -1841,9 +1815,7 @@ void QtEnumEditorFactoryPrivate::slotEnumNamesChanged(QtProperty *property, QMap<int, QIcon> enumIcons = manager->enumIcons(property); - QListIterator<QComboBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QComboBox *editor = itEditor.next(); + for (QComboBox *editor : it.value()) { editor->blockSignals(true); editor->clear(); editor->addItems(enumNames); @@ -1858,7 +1830,8 @@ void QtEnumEditorFactoryPrivate::slotEnumNamesChanged(QtProperty *property, void QtEnumEditorFactoryPrivate::slotEnumIconsChanged(QtProperty *property, const QMap<int, QIcon> &enumIcons) { - if (!m_createdEditors.contains(property)) + const auto it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; QtEnumPropertyManager *manager = q_ptr->propertyManager(property); @@ -1866,9 +1839,7 @@ void QtEnumEditorFactoryPrivate::slotEnumIconsChanged(QtProperty *property, return; const QStringList enumNames = manager->enumNames(property); - QListIterator<QComboBox *> itEditor(m_createdEditors[property]); - while (itEditor.hasNext()) { - QComboBox *editor = itEditor.next(); + for (QComboBox *editor : it.value()) { editor->blockSignals(true); const int nameCount = enumNames.count(); for (int i = 0; i < nameCount; i++) @@ -2250,13 +2221,12 @@ public: void QtColorEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, const QColor &value) { - const PropertyToEditorListMap::iterator it = m_createdEditors.find(property); - if (it == m_createdEditors.end()) + const PropertyToEditorListMap::const_iterator it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QtColorEditWidget *> itEditor(it.value()); - while (itEditor.hasNext()) - itEditor.next()->setValue(value); + for (QtColorEditWidget *e : it.value()) + e->setValue(value); } void QtColorEditorFactoryPrivate::slotSetValue(const QColor &value) @@ -2463,13 +2433,12 @@ public: void QtFontEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, const QFont &value) { - const PropertyToEditorListMap::iterator it = m_createdEditors.find(property); - if (it == m_createdEditors.end()) + const PropertyToEditorListMap::const_iterator it = m_createdEditors.constFind(property); + if (it == m_createdEditors.constEnd()) return; - QListIterator<QtFontEditWidget *> itEditor(it.value()); - while (itEditor.hasNext()) - itEditor.next()->setValue(value); + for (QtFontEditWidget *e : it.value()) + e->setValue(value); } void QtFontEditorFactoryPrivate::slotSetValue(const QFont &value) diff --git a/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp index 015a36baf..b7534e25b 100644 --- a/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp +++ b/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp @@ -113,10 +113,7 @@ void QtGroupBoxPropertyBrowserPrivate::slotEditorDestroyed() void QtGroupBoxPropertyBrowserPrivate::slotUpdate() { - QListIterator<WidgetItem *> itItem(m_recreateQueue); - while (itItem.hasNext()) { - WidgetItem *item = itItem.next(); - + for (WidgetItem *item : qAsConst(m_recreateQueue)) { WidgetItem *par = item->parent; QWidget *w = 0; QGridLayout *l = 0; diff --git a/src/shared/qtpropertybrowser/qtpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtpropertybrowser.cpp index 2d032da7a..1282f2975 100644 --- a/src/shared/qtpropertybrowser/qtpropertybrowser.cpp +++ b/src/shared/qtpropertybrowser/qtpropertybrowser.cpp @@ -161,25 +161,16 @@ QtProperty::QtProperty(QtAbstractPropertyManager *manager) */ QtProperty::~QtProperty() { - QSetIterator<QtProperty *> itParent(d_ptr->m_parentItems); - while (itParent.hasNext()) { - QtProperty *property = itParent.next(); + for (QtProperty *property : qAsConst(d_ptr->m_parentItems)) property->d_ptr->m_manager->d_ptr->propertyRemoved(this, property); - } d_ptr->m_manager->d_ptr->propertyDestroyed(this); - QListIterator<QtProperty *> itChild(d_ptr->m_subItems); - while (itChild.hasNext()) { - QtProperty *property = itChild.next(); + for (QtProperty *property : qAsConst(d_ptr->m_subItems)) property->d_ptr->m_parentItems.remove(this); - } - itParent.toFront(); - while (itParent.hasNext()) { - QtProperty *property = itParent.next(); + for (QtProperty *property : qAsConst(d_ptr->m_parentItems)) property->d_ptr->m_subItems.removeAll(this); - } } /*! @@ -699,11 +690,8 @@ QtAbstractPropertyManager::~QtAbstractPropertyManager() */ void QtAbstractPropertyManager::clear() const { - while (!properties().isEmpty()) { - QSetIterator<QtProperty *> itProperty(properties()); - QtProperty *prop = itProperty.next(); - delete prop; - } + while (!d_ptr->m_properties.isEmpty()) + delete *d_ptr->m_properties.cbegin(); } /*! @@ -1291,12 +1279,9 @@ void QtAbstractPropertyBrowserPrivate::insertSubTree(QtProperty *property, m_managerToProperties[manager].append(property); m_propertyToParents[property].append(parentProperty); - QList<QtProperty *> subList = property->subProperties(); - QListIterator<QtProperty *> itSub(subList); - while (itSub.hasNext()) { - QtProperty *subProperty = itSub.next(); + const QList<QtProperty *> subList = property->subProperties(); + for (QtProperty *subProperty : subList) insertSubTree(subProperty, property); - } } void QtAbstractPropertyBrowserPrivate::removeSubTree(QtProperty *property, @@ -1331,12 +1316,9 @@ void QtAbstractPropertyBrowserPrivate::removeSubTree(QtProperty *property, m_managerToProperties.remove(manager); } - QList<QtProperty *> subList = property->subProperties(); - QListIterator<QtProperty *> itSub(subList); - while (itSub.hasNext()) { - QtProperty *subProperty = itSub.next(); + const QList<QtProperty *> subList = property->subProperties(); + for (QtProperty *subProperty : subList) removeSubTree(subProperty, property); - } } void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty) @@ -1344,14 +1326,11 @@ void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(QtProperty *property QMap<QtBrowserItem *, QtBrowserItem *> parentToAfter; if (afterProperty) { QMap<QtProperty *, QList<QtBrowserItem *> >::ConstIterator it = - m_propertyToIndexes.find(afterProperty); + m_propertyToIndexes.constFind(afterProperty); if (it == m_propertyToIndexes.constEnd()) return; - QList<QtBrowserItem *> indexes = it.value(); - QListIterator<QtBrowserItem *> itIndex(indexes); - while (itIndex.hasNext()) { - QtBrowserItem *idx = itIndex.next(); + for (QtBrowserItem *idx : it.value()) { QtBrowserItem *parentIdx = idx->parent(); if ((parentProperty && parentIdx && parentIdx->property() == parentProperty) || (!parentProperty && !parentIdx)) parentToAfter[idx->parent()] = idx; @@ -1362,12 +1341,8 @@ void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(QtProperty *property if (it == m_propertyToIndexes.constEnd()) return; - QList<QtBrowserItem *> indexes = it.value(); - QListIterator<QtBrowserItem *> itIndex(indexes); - while (itIndex.hasNext()) { - QtBrowserItem *idx = itIndex.next(); + for (QtBrowserItem *idx : it.value()) parentToAfter[idx] = 0; - } } else { parentToAfter[0] = 0; } @@ -1391,13 +1366,10 @@ QtBrowserItem *QtAbstractPropertyBrowserPrivate::createBrowserIndex(QtProperty * q_ptr->itemInserted(newIndex, afterIndex); - QList<QtProperty *> subItems = property->subProperties(); - QListIterator<QtProperty *> itChild(subItems); + const QList<QtProperty *> subItems = property->subProperties(); QtBrowserItem *afterChild = 0; - while (itChild.hasNext()) { - QtProperty *child = itChild.next(); + for (QtProperty *child : subItems) afterChild = createBrowserIndex(child, newIndex, afterChild); - } return newIndex; } @@ -1405,24 +1377,18 @@ void QtAbstractPropertyBrowserPrivate::removeBrowserIndexes(QtProperty *property { QList<QtBrowserItem *> toRemove; QMap<QtProperty *, QList<QtBrowserItem *> >::ConstIterator it = - m_propertyToIndexes.find(property); + m_propertyToIndexes.constFind(property); if (it == m_propertyToIndexes.constEnd()) return; - QList<QtBrowserItem *> indexes = it.value(); - QListIterator<QtBrowserItem *> itIndex(indexes); - while (itIndex.hasNext()) { - QtBrowserItem *idx = itIndex.next(); + for (QtBrowserItem *idx : it.value()) { QtBrowserItem *parentIdx = idx->parent(); if ((parentProperty && parentIdx && parentIdx->property() == parentProperty) || (!parentProperty && !parentIdx)) toRemove.append(idx); } - QListIterator<QtBrowserItem *> itRemove(toRemove); - while (itRemove.hasNext()) { - QtBrowserItem *index = itRemove.next(); + for (QtBrowserItem *index : qAsConst(toRemove)) removeBrowserIndex(index); - } } void QtAbstractPropertyBrowserPrivate::removeBrowserIndex(QtBrowserItem *index) @@ -1452,11 +1418,9 @@ void QtAbstractPropertyBrowserPrivate::removeBrowserIndex(QtBrowserItem *index) void QtAbstractPropertyBrowserPrivate::clearIndex(QtBrowserItem *index) { - QList<QtBrowserItem *> children = index->children(); - QListIterator<QtBrowserItem *> itChild(children); - while (itChild.hasNext()) { - clearIndex(itChild.next()); - } + const QList<QtBrowserItem *> children = index->children(); + for (QtBrowserItem *item : children) + clearIndex(item); delete index; } @@ -1497,12 +1461,9 @@ void QtAbstractPropertyBrowserPrivate::slotPropertyDataChanged(QtProperty *prope if (it == m_propertyToIndexes.constEnd()) return; - QList<QtBrowserItem *> indexes = it.value(); - QListIterator<QtBrowserItem *> itIndex(indexes); - while (itIndex.hasNext()) { - QtBrowserItem *idx = itIndex.next(); + const QList<QtBrowserItem *> indexes = it.value(); + for (QtBrowserItem *idx : indexes) q_ptr->itemChanged(idx); - } //q_ptr->propertyChanged(property); } @@ -1701,10 +1662,9 @@ QtAbstractPropertyBrowser::QtAbstractPropertyBrowser(QWidget *parent) */ QtAbstractPropertyBrowser::~QtAbstractPropertyBrowser() { - QList<QtBrowserItem *> indexes = topLevelItems(); - QListIterator<QtBrowserItem *> itItem(indexes); - while (itItem.hasNext()) - d_ptr->clearIndex(itItem.next()); + const QList<QtBrowserItem *> indexes = topLevelItems(); + for (QtBrowserItem *item : indexes) + d_ptr->clearIndex(item); } /*! @@ -1767,13 +1727,9 @@ QList<QtBrowserItem *> QtAbstractPropertyBrowser::topLevelItems() const */ void QtAbstractPropertyBrowser::clear() { - QList<QtProperty *> subList = properties(); - QListIterator<QtProperty *> itSub(subList); - itSub.toBack(); - while (itSub.hasPrevious()) { - QtProperty *property = itSub.previous(); - removeProperty(property); - } + const QList<QtProperty *> subList = properties(); + for (auto rit = subList.crbegin(), rend = subList.crend(); rit != rend; ++rit) + removeProperty(*rit); } /*! diff --git a/src/shared/qtpropertybrowser/qtpropertybrowser.h b/src/shared/qtpropertybrowser/qtpropertybrowser.h index 5ab236c44..8a1b63521 100644 --- a/src/shared/qtpropertybrowser/qtpropertybrowser.h +++ b/src/shared/qtpropertybrowser/qtpropertybrowser.h @@ -148,9 +148,7 @@ public: explicit QtAbstractEditorFactory(QObject *parent) : QtAbstractEditorFactoryBase(parent) {} QWidget *createEditor(QtProperty *property, QWidget *parent) { - QSetIterator<PropertyManager *> it(m_managers); - while (it.hasNext()) { - PropertyManager *manager = it.next(); + for (PropertyManager *manager : qAsConst(m_managers)) { if (manager == property->propertyManager()) { return createEditor(manager, property, parent); } @@ -182,9 +180,7 @@ public: PropertyManager *propertyManager(QtProperty *property) const { QtAbstractPropertyManager *manager = property->propertyManager(); - QSetIterator<PropertyManager *> itManager(m_managers); - while (itManager.hasNext()) { - PropertyManager *m = itManager.next(); + for (PropertyManager *m : qAsConst(m_managers)) { if (m == manager) { return m; } @@ -198,9 +194,7 @@ protected: virtual void disconnectPropertyManager(PropertyManager *manager) = 0; void managerDestroyed(QObject *manager) { - QSetIterator<PropertyManager *> it(m_managers); - while (it.hasNext()) { - PropertyManager *m = it.next(); + for (PropertyManager *m : qAsConst(m_managers)) { if (m == manager) { m_managers.remove(m); return; @@ -210,9 +204,7 @@ protected: private: void breakConnection(QtAbstractPropertyManager *manager) { - QSetIterator<PropertyManager *> it(m_managers); - while (it.hasNext()) { - PropertyManager *m = it.next(); + for (PropertyManager *m : qAsConst(m_managers)) { if (m == manager) { removePropertyManager(m); return; diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.cpp b/src/shared/qtpropertybrowser/qtpropertymanager.cpp index 14b6125fd..1f7a9827b 100644 --- a/src/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/src/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -408,11 +408,8 @@ private: static QList<QLocale::Country> sortCountries(const QList<QLocale::Country> &countries) { QMultiMap<QString, QLocale::Country> nameToCountry; - QListIterator<QLocale::Country> itCountry(countries); - while (itCountry.hasNext()) { - QLocale::Country country = itCountry.next(); + for (QLocale::Country country : countries) nameToCountry.insert(QLocale::countryToString(country), country); - } return nameToCountry.values(); } @@ -431,10 +428,8 @@ void QtMetaEnumProvider::initLocale() if (!nameToLanguage.contains(QLocale::languageToString(system.language()))) nameToLanguage.insert(QLocale::languageToString(system.language()), system.language()); - QList<QLocale::Language> languages = nameToLanguage.values(); - QListIterator<QLocale::Language> itLang(languages); - while (itLang.hasNext()) { - QLocale::Language language = itLang.next(); + const QList<QLocale::Language> languages = nameToLanguage.values(); + for (QLocale::Language language : languages) { QList<QLocale::Country> countries; countries = QLocale::countriesForLanguage(language); if (countries.isEmpty() && language == system.language()) @@ -446,10 +441,8 @@ void QtMetaEnumProvider::initLocale() m_indexToLanguage[langIdx] = language; m_languageToIndex[language] = langIdx; QStringList countryNames; - QListIterator<QLocale::Country> it(countries); int countryIdx = 0; - while (it.hasNext()) { - QLocale::Country country = it.next(); + for (QLocale::Country country : qAsConst(countries)) { countryNames << QLocale::countryToString(country); m_indexToCountry[langIdx][countryIdx] = country; m_countryToIndex[language][country] = countryIdx; @@ -4898,10 +4891,11 @@ void QtFlagPropertyManagerPrivate::slotBoolChanged(QtProperty *property, bool va if (prop == 0) return; - QListIterator<QtProperty *> itProp(m_propertyToFlags[prop]); + const auto pfit = m_propertyToFlags.constFind(prop); + if (pfit == m_propertyToFlags.constEnd()) + return; int level = 0; - while (itProp.hasNext()) { - QtProperty *p = itProp.next(); + for (QtProperty *p : pfit.value()) { if (p == property) { int v = m_values[prop].val; if (value) { @@ -5102,13 +5096,14 @@ void QtFlagPropertyManager::setValue(QtProperty *property, int val) it.value() = data; - QListIterator<QtProperty *> itProp(d_ptr->m_propertyToFlags[property]); + const auto pfit = d_ptr->m_propertyToFlags.constFind(property); int level = 0; - while (itProp.hasNext()) { - QtProperty *prop = itProp.next(); - if (prop) - d_ptr->m_boolPropertyManager->setValue(prop, val & (1 << level)); - level++; + if (pfit != d_ptr->m_propertyToFlags.constEnd()) { + for (QtProperty *prop : pfit.value()) { + if (prop) + d_ptr->m_boolPropertyManager->setValue(prop, val & (1 << level)); + level++; + } } emit propertyChanged(property); @@ -5138,19 +5133,18 @@ void QtFlagPropertyManager::setFlagNames(QtProperty *property, const QStringList it.value() = data; - QListIterator<QtProperty *> itProp(d_ptr->m_propertyToFlags[property]); - while (itProp.hasNext()) { - QtProperty *prop = itProp.next(); - if (prop) { - delete prop; - d_ptr->m_flagToProperty.remove(prop); + const auto pfit = d_ptr->m_propertyToFlags.find(property); + if (pfit != d_ptr->m_propertyToFlags.end()) { + for (QtProperty *prop : qAsConst(pfit.value())) { + if (prop) { + delete prop; + d_ptr->m_flagToProperty.remove(prop); + } } + pfit.value().clear(); } - d_ptr->m_propertyToFlags[property].clear(); - QStringListIterator itFlag(flagNames); - while (itFlag.hasNext()) { - const QString flagName = itFlag.next(); + for (const QString &flagName : flagNames) { QtProperty *prop = d_ptr->m_boolPropertyManager->addProperty(); prop->setPropertyName(flagName); property->addSubProperty(prop); @@ -5179,15 +5173,16 @@ void QtFlagPropertyManager::initializeProperty(QtProperty *property) */ void QtFlagPropertyManager::uninitializeProperty(QtProperty *property) { - QListIterator<QtProperty *> itProp(d_ptr->m_propertyToFlags[property]); - while (itProp.hasNext()) { - QtProperty *prop = itProp.next(); - if (prop) { - delete prop; - d_ptr->m_flagToProperty.remove(prop); + const auto it = d_ptr->m_propertyToFlags.find(property); + if (it != d_ptr->m_propertyToFlags.end()) { + for (QtProperty *prop : qAsConst(it.value())) { + if (prop) { + delete prop; + d_ptr->m_flagToProperty.remove(prop); + } } } - d_ptr->m_propertyToFlags.remove(property); + d_ptr->m_propertyToFlags.erase(it); d_ptr->m_values.remove(property); } diff --git a/src/shared/qtpropertybrowser/qttreepropertybrowser.cpp b/src/shared/qtpropertybrowser/qttreepropertybrowser.cpp index 5bd379c96..6c1338c77 100644 --- a/src/shared/qtpropertybrowser/qttreepropertybrowser.cpp +++ b/src/shared/qtpropertybrowser/qttreepropertybrowser.cpp @@ -773,9 +773,8 @@ bool QtTreePropertyBrowser::rootIsDecorated() const void QtTreePropertyBrowser::setRootIsDecorated(bool show) { d_ptr->m_treeWidget->setRootIsDecorated(show); - QMapIterator<QTreeWidgetItem *, QtBrowserItem *> it(d_ptr->m_itemToIndex); - while (it.hasNext()) { - QtProperty *property = it.next().value()->property(); + for (auto it = d_ptr->m_itemToIndex.cbegin(), end = d_ptr->m_itemToIndex.cend(); it != end; ++it) { + QtProperty *property = it.value()->property(); if (!property->hasValue()) d_ptr->updateItem(it.key()); } @@ -794,7 +793,6 @@ bool QtTreePropertyBrowser::alternatingRowColors() const void QtTreePropertyBrowser::setAlternatingRowColors(bool enable) { d_ptr->m_treeWidget->setAlternatingRowColors(enable); - QMapIterator<QTreeWidgetItem *, QtBrowserItem *> it(d_ptr->m_itemToIndex); } /*! @@ -989,9 +987,8 @@ void QtTreePropertyBrowser::setPropertiesWithoutValueMarked(bool mark) return; d_ptr->m_markPropertiesWithoutValue = mark; - QMapIterator<QTreeWidgetItem *, QtBrowserItem *> it(d_ptr->m_itemToIndex); - while (it.hasNext()) { - QtProperty *property = it.next().value()->property(); + for (auto it = d_ptr->m_itemToIndex.cbegin(), end = d_ptr->m_itemToIndex.cend(); it != end; ++it) { + QtProperty *property = it.value()->property(); if (!property->hasValue()) d_ptr->updateItem(it.key()); } diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.cpp b/src/shared/qtpropertybrowser/qtvariantproperty.cpp index 966b17be8..51a2f2cf9 100644 --- a/src/shared/qtpropertybrowser/qtvariantproperty.cpp +++ b/src/shared/qtpropertybrowser/qtvariantproperty.cpp @@ -1784,11 +1784,10 @@ void QtVariantPropertyManager::initializeProperty(QtProperty *property) } propertyToWrappedProperty()->insert(varProp, internProp); if (internProp) { - QList<QtProperty *> children = internProp->subProperties(); - QListIterator<QtProperty *> itChild(children); + const QList<QtProperty *> children = internProp->subProperties(); QtVariantProperty *lastProperty = 0; - while (itChild.hasNext()) { - QtVariantProperty *prop = d_ptr->createSubProperty(varProp, lastProperty, itChild.next()); + for (QtProperty *child : children) { + QtVariantProperty *prop = d_ptr->createSubProperty(varProp, lastProperty, child); lastProperty = prop ? prop : lastProperty; } } @@ -1994,126 +1993,101 @@ QtVariantEditorFactory::~QtVariantEditorFactory() */ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *manager) { - QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); - QListIterator<QtIntPropertyManager *> itInt(intPropertyManagers); - while (itInt.hasNext()) - d_ptr->m_spinBoxFactory->addPropertyManager(itInt.next()); - - QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); - QListIterator<QtDoublePropertyManager *> itDouble(doublePropertyManagers); - while (itDouble.hasNext()) - d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itDouble.next()); - - QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); - QListIterator<QtBoolPropertyManager *> itBool(boolPropertyManagers); - while (itBool.hasNext()) - d_ptr->m_checkBoxFactory->addPropertyManager(itBool.next()); - - QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); - QListIterator<QtStringPropertyManager *> itString(stringPropertyManagers); - while (itString.hasNext()) - d_ptr->m_lineEditFactory->addPropertyManager(itString.next()); - - QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); - QListIterator<QtDatePropertyManager *> itDate(datePropertyManagers); - while (itDate.hasNext()) - d_ptr->m_dateEditFactory->addPropertyManager(itDate.next()); - - QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); - QListIterator<QtTimePropertyManager *> itTime(timePropertyManagers); - while (itTime.hasNext()) - d_ptr->m_timeEditFactory->addPropertyManager(itTime.next()); - - QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); - QListIterator<QtDateTimePropertyManager *> itDateTime(dateTimePropertyManagers); - while (itDateTime.hasNext()) - d_ptr->m_dateTimeEditFactory->addPropertyManager(itDateTime.next()); - - QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); - QListIterator<QtKeySequencePropertyManager *> itKeySequence(keySequencePropertyManagers); - while (itKeySequence.hasNext()) - d_ptr->m_keySequenceEditorFactory->addPropertyManager(itKeySequence.next()); - - QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); - QListIterator<QtCharPropertyManager *> itChar(charPropertyManagers); - while (itChar.hasNext()) - d_ptr->m_charEditorFactory->addPropertyManager(itChar.next()); - - QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); - QListIterator<QtLocalePropertyManager *> itLocale(localePropertyManagers); - while (itLocale.hasNext()) - d_ptr->m_comboBoxFactory->addPropertyManager(itLocale.next()->subEnumPropertyManager()); - - QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); - QListIterator<QtPointPropertyManager *> itPoint(pointPropertyManagers); - while (itPoint.hasNext()) - d_ptr->m_spinBoxFactory->addPropertyManager(itPoint.next()->subIntPropertyManager()); - - QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); - QListIterator<QtPointFPropertyManager *> itPointF(pointFPropertyManagers); - while (itPointF.hasNext()) - d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itPointF.next()->subDoublePropertyManager()); - - QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); - QListIterator<QtSizePropertyManager *> itSize(sizePropertyManagers); - while (itSize.hasNext()) - d_ptr->m_spinBoxFactory->addPropertyManager(itSize.next()->subIntPropertyManager()); - - QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); - QListIterator<QtSizeFPropertyManager *> itSizeF(sizeFPropertyManagers); - while (itSizeF.hasNext()) - d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itSizeF.next()->subDoublePropertyManager()); - - QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); - QListIterator<QtRectPropertyManager *> itRect(rectPropertyManagers); - while (itRect.hasNext()) - d_ptr->m_spinBoxFactory->addPropertyManager(itRect.next()->subIntPropertyManager()); - - QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); - QListIterator<QtRectFPropertyManager *> itRectF(rectFPropertyManagers); - while (itRectF.hasNext()) - d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itRectF.next()->subDoublePropertyManager()); - - QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); - QListIterator<QtColorPropertyManager *> itColor(colorPropertyManagers); - while (itColor.hasNext()) { - QtColorPropertyManager *manager = itColor.next(); + const QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); + for (QtIntPropertyManager *manager : intPropertyManagers) + d_ptr->m_spinBoxFactory->addPropertyManager(manager); + + const QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); + for (QtDoublePropertyManager *manager : doublePropertyManagers) + d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager); + + const QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); + for (QtBoolPropertyManager *manager : boolPropertyManagers) + d_ptr->m_checkBoxFactory->addPropertyManager(manager); + + const QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); + for (QtStringPropertyManager *manager : stringPropertyManagers) + d_ptr->m_lineEditFactory->addPropertyManager(manager); + + const QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); + for (QtDatePropertyManager *manager : datePropertyManagers) + d_ptr->m_dateEditFactory->addPropertyManager(manager); + + const QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); + for (QtTimePropertyManager *manager : timePropertyManagers) + d_ptr->m_timeEditFactory->addPropertyManager(manager); + + const QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); + for (QtDateTimePropertyManager *manager : dateTimePropertyManagers) + d_ptr->m_dateTimeEditFactory->addPropertyManager(manager); + + const QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); + for (QtKeySequencePropertyManager *manager : keySequencePropertyManagers) + d_ptr->m_keySequenceEditorFactory->addPropertyManager(manager); + + const QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); + for (QtCharPropertyManager *manager : charPropertyManagers) + d_ptr->m_charEditorFactory->addPropertyManager(manager); + + const QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); + for (QtLocalePropertyManager *manager : localePropertyManagers) + d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); + + const QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); + for (QtPointPropertyManager *manager : pointPropertyManagers) + d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); + + const QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); + for (QtPointFPropertyManager *manager : pointFPropertyManagers) + d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager->subDoublePropertyManager()); + + const QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); + for (QtSizePropertyManager *manager : sizePropertyManagers) + d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); + + const QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); + for (QtSizeFPropertyManager *manager : sizeFPropertyManagers) + d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager->subDoublePropertyManager()); + + const QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); + for (QtRectPropertyManager *manager : rectPropertyManagers) + d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); + + const QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); + for (QtRectFPropertyManager *manager : rectFPropertyManagers) + d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager->subDoublePropertyManager()); + + const QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); + for (QtColorPropertyManager *manager : colorPropertyManagers) { d_ptr->m_colorEditorFactory->addPropertyManager(manager); d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); } - QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); - QListIterator<QtEnumPropertyManager *> itEnum(enumPropertyManagers); - while (itEnum.hasNext()) - d_ptr->m_comboBoxFactory->addPropertyManager(itEnum.next()); + const QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); + for (QtEnumPropertyManager *manager : enumPropertyManagers) + d_ptr->m_comboBoxFactory->addPropertyManager(manager); - QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); - QListIterator<QtSizePolicyPropertyManager *> itSizePolicy(sizePolicyPropertyManagers); - while (itSizePolicy.hasNext()) { - QtSizePolicyPropertyManager *manager = itSizePolicy.next(); + const QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); + for (QtSizePolicyPropertyManager *manager : sizePolicyPropertyManagers) { d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); } - QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); - QListIterator<QtFontPropertyManager *> itFont(fontPropertyManagers); - while (itFont.hasNext()) { - QtFontPropertyManager *manager = itFont.next(); + const QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); + for (QtFontPropertyManager *manager : fontPropertyManagers) { d_ptr->m_fontEditorFactory->addPropertyManager(manager); d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager()); } - QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); - QListIterator<QtCursorPropertyManager *> itCursor(cursorPropertyManagers); - while (itCursor.hasNext()) - d_ptr->m_cursorEditorFactory->addPropertyManager(itCursor.next()); + const QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); + for (QtCursorPropertyManager *manager : cursorPropertyManagers) + d_ptr->m_cursorEditorFactory->addPropertyManager(manager); - QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); - QListIterator<QtFlagPropertyManager *> itFlag(flagPropertyManagers); - while (itFlag.hasNext()) - d_ptr->m_checkBoxFactory->addPropertyManager(itFlag.next()->subBoolPropertyManager()); + const QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); + for (QtFlagPropertyManager *manager : flagPropertyManagers) + d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager()); } /*! @@ -2138,126 +2112,101 @@ QWidget *QtVariantEditorFactory::createEditor(QtVariantPropertyManager *manager, */ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager *manager) { - QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); - QListIterator<QtIntPropertyManager *> itInt(intPropertyManagers); - while (itInt.hasNext()) - d_ptr->m_spinBoxFactory->removePropertyManager(itInt.next()); - - QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); - QListIterator<QtDoublePropertyManager *> itDouble(doublePropertyManagers); - while (itDouble.hasNext()) - d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itDouble.next()); - - QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); - QListIterator<QtBoolPropertyManager *> itBool(boolPropertyManagers); - while (itBool.hasNext()) - d_ptr->m_checkBoxFactory->removePropertyManager(itBool.next()); - - QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); - QListIterator<QtStringPropertyManager *> itString(stringPropertyManagers); - while (itString.hasNext()) - d_ptr->m_lineEditFactory->removePropertyManager(itString.next()); - - QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); - QListIterator<QtDatePropertyManager *> itDate(datePropertyManagers); - while (itDate.hasNext()) - d_ptr->m_dateEditFactory->removePropertyManager(itDate.next()); - - QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); - QListIterator<QtTimePropertyManager *> itTime(timePropertyManagers); - while (itTime.hasNext()) - d_ptr->m_timeEditFactory->removePropertyManager(itTime.next()); - - QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); - QListIterator<QtDateTimePropertyManager *> itDateTime(dateTimePropertyManagers); - while (itDateTime.hasNext()) - d_ptr->m_dateTimeEditFactory->removePropertyManager(itDateTime.next()); - - QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); - QListIterator<QtKeySequencePropertyManager *> itKeySequence(keySequencePropertyManagers); - while (itKeySequence.hasNext()) - d_ptr->m_keySequenceEditorFactory->removePropertyManager(itKeySequence.next()); - - QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); - QListIterator<QtCharPropertyManager *> itChar(charPropertyManagers); - while (itChar.hasNext()) - d_ptr->m_charEditorFactory->removePropertyManager(itChar.next()); - - QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); - QListIterator<QtLocalePropertyManager *> itLocale(localePropertyManagers); - while (itLocale.hasNext()) - d_ptr->m_comboBoxFactory->removePropertyManager(itLocale.next()->subEnumPropertyManager()); - - QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); - QListIterator<QtPointPropertyManager *> itPoint(pointPropertyManagers); - while (itPoint.hasNext()) - d_ptr->m_spinBoxFactory->removePropertyManager(itPoint.next()->subIntPropertyManager()); - - QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); - QListIterator<QtPointFPropertyManager *> itPointF(pointFPropertyManagers); - while (itPointF.hasNext()) - d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itPointF.next()->subDoublePropertyManager()); - - QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); - QListIterator<QtSizePropertyManager *> itSize(sizePropertyManagers); - while (itSize.hasNext()) - d_ptr->m_spinBoxFactory->removePropertyManager(itSize.next()->subIntPropertyManager()); - - QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); - QListIterator<QtSizeFPropertyManager *> itSizeF(sizeFPropertyManagers); - while (itSizeF.hasNext()) - d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itSizeF.next()->subDoublePropertyManager()); - - QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); - QListIterator<QtRectPropertyManager *> itRect(rectPropertyManagers); - while (itRect.hasNext()) - d_ptr->m_spinBoxFactory->removePropertyManager(itRect.next()->subIntPropertyManager()); - - QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); - QListIterator<QtRectFPropertyManager *> itRectF(rectFPropertyManagers); - while (itRectF.hasNext()) - d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itRectF.next()->subDoublePropertyManager()); - - QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); - QListIterator<QtColorPropertyManager *> itColor(colorPropertyManagers); - while (itColor.hasNext()) { - QtColorPropertyManager *manager = itColor.next(); + const QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); + for (QtIntPropertyManager *manager : intPropertyManagers) + d_ptr->m_spinBoxFactory->removePropertyManager(manager); + + const QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); + for (QtDoublePropertyManager *manager : doublePropertyManagers) + d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager); + + const QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); + for (QtBoolPropertyManager *manager : boolPropertyManagers) + d_ptr->m_checkBoxFactory->removePropertyManager(manager); + + const QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); + for (QtStringPropertyManager *manager : stringPropertyManagers) + d_ptr->m_lineEditFactory->removePropertyManager(manager); + + const QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); + for (QtDatePropertyManager *manager : datePropertyManagers) + d_ptr->m_dateEditFactory->removePropertyManager(manager); + + const QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); + for (QtTimePropertyManager *manager : timePropertyManagers) + d_ptr->m_timeEditFactory->removePropertyManager(manager); + + const QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); + for (QtDateTimePropertyManager *manager : dateTimePropertyManagers) + d_ptr->m_dateTimeEditFactory->removePropertyManager(manager); + + const QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); + for (QtKeySequencePropertyManager *manager : keySequencePropertyManagers) + d_ptr->m_keySequenceEditorFactory->removePropertyManager(manager); + + const QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); + for (QtCharPropertyManager *manager : charPropertyManagers) + d_ptr->m_charEditorFactory->removePropertyManager(manager); + + const QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); + for (QtLocalePropertyManager *manager : localePropertyManagers) + d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); + + const QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); + for (QtPointPropertyManager *manager : pointPropertyManagers) + d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); + + const QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); + for (QtPointFPropertyManager *manager : pointFPropertyManagers) + d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager->subDoublePropertyManager()); + + const QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); + for (QtSizePropertyManager *manager : sizePropertyManagers) + d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); + + const QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); + for (QtSizeFPropertyManager *manager : sizeFPropertyManagers) + d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager->subDoublePropertyManager()); + + const QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); + for (QtRectPropertyManager *manager : rectPropertyManagers) + d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); + + const QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); + for (QtRectFPropertyManager *manager : rectFPropertyManagers) + d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager->subDoublePropertyManager()); + + const QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); + for (QtColorPropertyManager *manager : colorPropertyManagers) { d_ptr->m_colorEditorFactory->removePropertyManager(manager); d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); } - QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); - QListIterator<QtEnumPropertyManager *> itEnum(enumPropertyManagers); - while (itEnum.hasNext()) - d_ptr->m_comboBoxFactory->removePropertyManager(itEnum.next()); + const QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); + for (QtEnumPropertyManager *manager : enumPropertyManagers) + d_ptr->m_comboBoxFactory->removePropertyManager(manager); - QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); - QListIterator<QtSizePolicyPropertyManager *> itSizePolicy(sizePolicyPropertyManagers); - while (itSizePolicy.hasNext()) { - QtSizePolicyPropertyManager *manager = itSizePolicy.next(); + const QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); + for (QtSizePolicyPropertyManager *manager : sizePolicyPropertyManagers) { d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); } - QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); - QListIterator<QtFontPropertyManager *> itFont(fontPropertyManagers); - while (itFont.hasNext()) { - QtFontPropertyManager *manager = itFont.next(); + const QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); + for (QtFontPropertyManager *manager : fontPropertyManagers) { d_ptr->m_fontEditorFactory->removePropertyManager(manager); d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager()); } - QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); - QListIterator<QtCursorPropertyManager *> itCursor(cursorPropertyManagers); - while (itCursor.hasNext()) - d_ptr->m_cursorEditorFactory->removePropertyManager(itCursor.next()); + const QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); + for (QtCursorPropertyManager *manager : cursorPropertyManagers) + d_ptr->m_cursorEditorFactory->removePropertyManager(manager); - QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); - QListIterator<QtFlagPropertyManager *> itFlag(flagPropertyManagers); - while (itFlag.hasNext()) - d_ptr->m_checkBoxFactory->removePropertyManager(itFlag.next()->subBoolPropertyManager()); + const QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); + for (QtFlagPropertyManager *manager : flagPropertyManagers) + d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager()); } QT_END_NAMESPACE |