diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-08 13:27:30 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-19 15:35:46 +0100 |
commit | fc42c9d35665dbe9d5bce72d50ea14d1c6091628 (patch) | |
tree | b2ac99b215c7c8af979469dbe5bfd59267d38c32 /src/shared | |
parent | 01b12aabdc40a2d2c3f38fc03dfde9659458491b (diff) |
Qt Designer: Prepare for deprecation of classes in Qt 6
- Use auto for QStringRef.
- Use auto for QList and iterators, refactoring some loops.
Task-number: QTBUG-79896
Change-Id: I065d5b6d49404e51a10a7e1d7373eff41f9cb032
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/deviceskin/deviceskin.cpp | 2 | ||||
-rw-r--r-- | src/shared/fontpanel/fontpanel.cpp | 4 | ||||
-rw-r--r-- | src/shared/qtgradienteditor/qtgradientstopscontroller.cpp | 12 | ||||
-rw-r--r-- | src/shared/qtgradienteditor/qtgradientstopsmodel.cpp | 8 | ||||
-rw-r--r-- | src/shared/qtgradienteditor/qtgradientstopswidget.cpp | 8 | ||||
-rw-r--r-- | src/shared/qtgradienteditor/qtgradientwidget.cpp | 2 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qteditorfactory.cpp | 2 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertybrowser.cpp | 36 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertymanager.cpp | 2 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtvariantproperty.cpp | 90 | ||||
-rw-r--r-- | src/shared/qttoolbardialog/qttoolbardialog.cpp | 68 |
11 files changed, 113 insertions, 121 deletions
diff --git a/src/shared/deviceskin/deviceskin.cpp b/src/shared/deviceskin/deviceskin.cpp index b8649b9b3..593502d0a 100644 --- a/src/shared/deviceskin/deviceskin.cpp +++ b/src/shared/deviceskin/deviceskin.cpp @@ -69,7 +69,7 @@ namespace { } static void parseRect(const QString &value, QRect *rect) { - const QVector<QStringRef> l = value.splitRef(QLatin1Char(' ')); + const auto l = value.splitRef(QLatin1Char(' ')); rect->setRect(l[0].toInt(), l[1].toInt(), l[2].toInt(), l[3].toInt()); } diff --git a/src/shared/fontpanel/fontpanel.cpp b/src/shared/fontpanel/fontpanel.cpp index 59238f6eb..2645d992e 100644 --- a/src/shared/fontpanel/fontpanel.cpp +++ b/src/shared/fontpanel/fontpanel.cpp @@ -64,7 +64,7 @@ FontPanel::FontPanel(QWidget *parentWidget) : // writing systems m_writingSystemComboBox->setEditable(false); - QList<QFontDatabase::WritingSystem> writingSystems = m_fontDatabase.writingSystems(); + auto writingSystems = m_fontDatabase.writingSystems(); writingSystems.push_front(QFontDatabase::Any); for (QFontDatabase::WritingSystem ws : qAsConst(writingSystems)) m_writingSystemComboBox->addItem(QFontDatabase::writingSystemName(ws), QVariant(ws)); @@ -269,7 +269,7 @@ void FontPanel::updatePointSizes(const QString &family, const QString &styleStri { const int oldPointSize = pointSize(); - QList<int> pointSizes = m_fontDatabase.pointSizes(family, styleString); + auto pointSizes = m_fontDatabase.pointSizes(family, styleString); if (pointSizes.isEmpty()) pointSizes = QFontDatabase::standardSizes(); diff --git a/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp b/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp index 57303f009..9fb44469a 100644 --- a/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp +++ b/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp @@ -402,7 +402,7 @@ void QtGradientStopsControllerPrivate::slotChangeColor(const QColor &color) if (!stop) return; m_model->changeStop(stop, color); - const QList<QtGradientStop *> stops = m_model->selectedStops(); + const auto stops = m_model->selectedStops(); for (QtGradientStop *s : stops) { if (s != stop) m_model->changeStop(s, color); @@ -415,7 +415,7 @@ void QtGradientStopsControllerPrivate::slotChangeHue(const QColor &color) if (!stop) return; m_model->changeStop(stop, color); - const QList<QtGradientStop *> stops = m_model->selectedStops(); + const auto stops = m_model->selectedStops(); for (QtGradientStop *s : stops) { if (s != stop) { QColor c = s->color(); @@ -444,7 +444,7 @@ void QtGradientStopsControllerPrivate::slotChangeSaturation(const QColor &color) if (!stop) return; m_model->changeStop(stop, color); - const QList<QtGradientStop *> stops = m_model->selectedStops(); + const auto stops = m_model->selectedStops(); for (QtGradientStop *s : stops) { if (s != stop) { QColor c = s->color(); @@ -477,7 +477,7 @@ void QtGradientStopsControllerPrivate::slotChangeValue(const QColor &color) if (!stop) return; m_model->changeStop(stop, color); - const QList<QtGradientStop *> stops = m_model->selectedStops(); + const auto stops = m_model->selectedStops(); for (QtGradientStop *s : stops) { if (s != stop) { QColor c = s->color(); @@ -510,7 +510,7 @@ void QtGradientStopsControllerPrivate::slotChangeAlpha(const QColor &color) if (!stop) return; m_model->changeStop(stop, color); - const QList<QtGradientStop *> stops = m_model->selectedStops(); + const auto stops = m_model->selectedStops(); for (QtGradientStop *s : stops) { if (s != stop) { QColor c = s->color(); @@ -676,7 +676,7 @@ void QtGradientStopsController::setGradientStops(const QGradientStops &stops) QGradientStops QtGradientStopsController::gradientStops() const { QGradientStops stops; - const QList<QtGradientStop *> stopsList = d_ptr->m_model->stops().values(); + const auto stopsList = d_ptr->m_model->stops().values(); for (const QtGradientStop *stop : stopsList) stops << QPair<qreal, QColor>(stop->position(), stop->color()); return stops; diff --git a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp index d35c1f025..0afbf49bb 100644 --- a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp +++ b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp @@ -375,7 +375,7 @@ void QtGradientStopsModel::moveStops(double newPosition) PositionStopMap stopList; - const QList<QtGradientStop *> selected = selectedStops(); + const auto selected = selectedStops(); for (QtGradientStop *stop : selected) stopList[stop->position()] = stop; stopList[current->position()] = current; @@ -406,14 +406,14 @@ void QtGradientStopsModel::moveStops(double newPosition) void QtGradientStopsModel::clear() { - const QList<QtGradientStop *> stopsList = stops().values(); + const auto stopsList = stops().values(); for (QtGradientStop *stop : stopsList) removeStop(stop); } void QtGradientStopsModel::clearSelection() { - const QList<QtGradientStop *> stopsList = selectedStops(); + const auto stopsList = selectedStops(); for (QtGradientStop *stop : stopsList) selectStop(stop, false); } @@ -452,7 +452,7 @@ void QtGradientStopsModel::selectAll() void QtGradientStopsModel::deleteStops() { - const QList<QtGradientStop *> selected = selectedStops(); + const auto selected = selectedStops(); for (QtGradientStop *stop : selected) removeStop(stop); QtGradientStop *current = currentStop(); diff --git a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp index 3bfd30627..49569869e 100644 --- a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp +++ b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp @@ -170,7 +170,7 @@ void QtGradientStopsWidgetPrivate::setupMove(QtGradientStop *stop, int x) int viewportX = qRound(toViewport(stop->position())); m_moveOffset = x - viewportX; - const QList<QtGradientStop *> stops = m_stops; + const auto stops = m_stops; m_stops.clear(); for (QtGradientStop *s : stops) { if (m_model->isSelected(s) || s == stop) { @@ -450,7 +450,7 @@ void QtGradientStopsWidget::setGradientStopsModel(QtGradientStopsModel *model) for (auto it = stopsMap.cbegin(), end = stopsMap.cend(); it != end; ++it) d_ptr->slotStopAdded(it.value()); - const QList<QtGradientStop *> selected = d_ptr->m_model->selectedStops(); + const auto selected = d_ptr->m_model->selectedStops(); for (QtGradientStop *stop : selected) d_ptr->slotStopSelected(stop, true); @@ -652,8 +652,8 @@ void QtGradientStopsWidget::mouseMoveEvent(QMouseEvent *e) p2 = QPoint(xv2, qRound(d_ptr->m_handleSize / 2)); } - QList<QtGradientStop *> beginList = d_ptr->stopsAt(p1); - QList<QtGradientStop *> endList = d_ptr->stopsAt(p2); + const auto beginList = d_ptr->stopsAt(p1); + const auto endList = d_ptr->stopsAt(p2); double x1 = d_ptr->fromViewport(xv1); double x2 = d_ptr->fromViewport(xv2); diff --git a/src/shared/qtgradienteditor/qtgradientwidget.cpp b/src/shared/qtgradienteditor/qtgradientwidget.cpp index 9db1b82e6..ebd5ba159 100644 --- a/src/shared/qtgradienteditor/qtgradientwidget.cpp +++ b/src/shared/qtgradienteditor/qtgradientwidget.cpp @@ -203,7 +203,7 @@ void QtGradientWidgetPrivate::setupDrag(QtGradientStop *stop, int x) int viewportX = qRound(toViewport(stop->position())); m_dragOffset = x - viewportX; - const QList<QtGradientStop *> stops = m_stops; + const auto stops = m_stops; m_stops.clear(); for (QtGradientStop *s : stops) { if (m_model->isSelected(s) || s == stop) { diff --git a/src/shared/qtpropertybrowser/qteditorfactory.cpp b/src/shared/qtpropertybrowser/qteditorfactory.cpp index aa3ddbf00..c83d20cfd 100644 --- a/src/shared/qtpropertybrowser/qteditorfactory.cpp +++ b/src/shared/qtpropertybrowser/qteditorfactory.cpp @@ -1543,7 +1543,7 @@ 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(); - const QList<QAction *> actions = menu->actions(); + const auto actions = menu->actions(); for (QAction *action : actions) { action->setShortcut(QKeySequence()); QString actionString = action->text(); diff --git a/src/shared/qtpropertybrowser/qtpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtpropertybrowser.cpp index 0e892a2ee..601fb854a 100644 --- a/src/shared/qtpropertybrowser/qtpropertybrowser.cpp +++ b/src/shared/qtpropertybrowser/qtpropertybrowser.cpp @@ -452,7 +452,7 @@ void QtProperty::insertSubProperty(QtProperty *property, return; // traverse all children of item. if this item is a child of item then cannot add. - QList<QtProperty *> pendingList = property->subProperties(); + auto pendingList = property->subProperties(); QMap<QtProperty *, bool> visited; while (!pendingList.isEmpty()) { QtProperty *i = pendingList.first(); @@ -499,7 +499,7 @@ void QtProperty::removeSubProperty(QtProperty *property) d_ptr->m_manager->d_ptr->propertyRemoved(property, this); - QList<QtProperty *> pendingList = subProperties(); + auto pendingList = subProperties(); int pos = 0; while (pos < pendingList.count()) { if (pendingList.at(pos) == property) { @@ -1279,7 +1279,7 @@ void QtAbstractPropertyBrowserPrivate::insertSubTree(QtProperty *property, m_managerToProperties[manager].append(property); m_propertyToParents[property].append(parentProperty); - const QList<QtProperty *> subList = property->subProperties(); + const auto subList = property->subProperties(); for (QtProperty *subProperty : subList) insertSubTree(subProperty, property); } @@ -1316,7 +1316,7 @@ void QtAbstractPropertyBrowserPrivate::removeSubTree(QtProperty *property, m_managerToProperties.remove(manager); } - const QList<QtProperty *> subList = property->subProperties(); + const auto subList = property->subProperties(); for (QtProperty *subProperty : subList) removeSubTree(subProperty, property); } @@ -1325,8 +1325,7 @@ void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(QtProperty *property { QMap<QtBrowserItem *, QtBrowserItem *> parentToAfter; if (afterProperty) { - QMap<QtProperty *, QList<QtBrowserItem *> >::ConstIterator it = - m_propertyToIndexes.constFind(afterProperty); + const auto it = m_propertyToIndexes.constFind(afterProperty); if (it == m_propertyToIndexes.constEnd()) return; @@ -1336,8 +1335,7 @@ void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(QtProperty *property parentToAfter[idx->parent()] = idx; } } else if (parentProperty) { - QMap<QtProperty *, QList<QtBrowserItem *> >::ConstIterator it = - m_propertyToIndexes.find(parentProperty); + const auto it = m_propertyToIndexes.find(parentProperty); if (it == m_propertyToIndexes.constEnd()) return; @@ -1366,7 +1364,7 @@ QtBrowserItem *QtAbstractPropertyBrowserPrivate::createBrowserIndex(QtProperty * q_ptr->itemInserted(newIndex, afterIndex); - const QList<QtProperty *> subItems = property->subProperties(); + const auto subItems = property->subProperties(); QtBrowserItem *afterChild = 0; for (QtProperty *child : subItems) afterChild = createBrowserIndex(child, newIndex, afterChild); @@ -1376,8 +1374,7 @@ QtBrowserItem *QtAbstractPropertyBrowserPrivate::createBrowserIndex(QtProperty * void QtAbstractPropertyBrowserPrivate::removeBrowserIndexes(QtProperty *property, QtProperty *parentProperty) { QList<QtBrowserItem *> toRemove; - QMap<QtProperty *, QList<QtBrowserItem *> >::ConstIterator it = - m_propertyToIndexes.constFind(property); + const auto it = m_propertyToIndexes.constFind(property); if (it == m_propertyToIndexes.constEnd()) return; @@ -1393,7 +1390,7 @@ void QtAbstractPropertyBrowserPrivate::removeBrowserIndexes(QtProperty *property void QtAbstractPropertyBrowserPrivate::removeBrowserIndex(QtBrowserItem *index) { - QList<QtBrowserItem *> children = index->children(); + const auto children = index->children(); for (int i = children.count(); i > 0; i--) { removeBrowserIndex(children.at(i - 1)); } @@ -1418,7 +1415,7 @@ void QtAbstractPropertyBrowserPrivate::removeBrowserIndex(QtBrowserItem *index) void QtAbstractPropertyBrowserPrivate::clearIndex(QtBrowserItem *index) { - const QList<QtBrowserItem *> children = index->children(); + const auto children = index->children(); for (QtBrowserItem *item : children) clearIndex(item); delete index; @@ -1456,12 +1453,11 @@ void QtAbstractPropertyBrowserPrivate::slotPropertyDataChanged(QtProperty *prope if (!m_propertyToParents.contains(property)) return; - QMap<QtProperty *, QList<QtBrowserItem *> >::ConstIterator it = - m_propertyToIndexes.find(property); + const auto it = m_propertyToIndexes.constFind(property); if (it == m_propertyToIndexes.constEnd()) return; - const QList<QtBrowserItem *> indexes = it.value(); + const auto indexes = it.value(); for (QtBrowserItem *idx : indexes) q_ptr->itemChanged(idx); //q_ptr->propertyChanged(property); @@ -1662,7 +1658,7 @@ QtAbstractPropertyBrowser::QtAbstractPropertyBrowser(QWidget *parent) */ QtAbstractPropertyBrowser::~QtAbstractPropertyBrowser() { - const QList<QtBrowserItem *> indexes = topLevelItems(); + const auto indexes = topLevelItems(); for (QtBrowserItem *item : indexes) d_ptr->clearIndex(item); } @@ -1727,7 +1723,7 @@ QList<QtBrowserItem *> QtAbstractPropertyBrowser::topLevelItems() const */ void QtAbstractPropertyBrowser::clear() { - const QList<QtProperty *> subList = properties(); + const auto subList = properties(); for (auto rit = subList.crbegin(), rend = subList.crend(); rit != rend; ++rit) removeProperty(*rit); } @@ -1775,7 +1771,7 @@ QtBrowserItem *QtAbstractPropertyBrowser::insertProperty(QtProperty *property, return 0; // if item is already inserted in this item then cannot add. - QList<QtProperty *> pendingList = properties(); + auto pendingList = properties(); int pos = 0; int newPos = 0; while (pos < pendingList.count()) { @@ -1813,7 +1809,7 @@ void QtAbstractPropertyBrowser::removeProperty(QtProperty *property) if (!property) return; - QList<QtProperty *> pendingList = properties(); + auto pendingList = properties(); int pos = 0; while (pos < pendingList.count()) { if (pendingList.at(pos) == property) { diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.cpp b/src/shared/qtpropertybrowser/qtpropertymanager.cpp index 2abcb1657..c1aeb624c 100644 --- a/src/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/src/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -428,7 +428,7 @@ void QtMetaEnumProvider::initLocale() if (!nameToLanguage.contains(QLocale::languageToString(system.language()))) nameToLanguage.insert(QLocale::languageToString(system.language()), system.language()); - const QList<QLocale::Language> languages = nameToLanguage.values(); + const auto languages = nameToLanguage.values(); for (QLocale::Language language : languages) { QList<QLocale::Country> countries; countries = QLocale::countriesForLanguage(language); diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.cpp b/src/shared/qtpropertybrowser/qtvariantproperty.cpp index e776f85fb..1ddc64fbc 100644 --- a/src/shared/qtpropertybrowser/qtvariantproperty.cpp +++ b/src/shared/qtpropertybrowser/qtvariantproperty.cpp @@ -1784,7 +1784,7 @@ void QtVariantPropertyManager::initializeProperty(QtProperty *property) } propertyToWrappedProperty()->insert(varProp, internProp); if (internProp) { - const QList<QtProperty *> children = internProp->subProperties(); + const auto children = internProp->subProperties(); QtVariantProperty *lastProperty = 0; for (QtProperty *child : children) { QtVariantProperty *prop = d_ptr->createSubProperty(varProp, lastProperty, child); @@ -1993,87 +1993,87 @@ QtVariantEditorFactory::~QtVariantEditorFactory() */ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *manager) { - const QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); + const auto intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); for (QtIntPropertyManager *manager : intPropertyManagers) d_ptr->m_spinBoxFactory->addPropertyManager(manager); - const QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); + const auto doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); for (QtDoublePropertyManager *manager : doublePropertyManagers) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager); - const QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); + const auto boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); for (QtBoolPropertyManager *manager : boolPropertyManagers) d_ptr->m_checkBoxFactory->addPropertyManager(manager); - const QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); + const auto stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); for (QtStringPropertyManager *manager : stringPropertyManagers) d_ptr->m_lineEditFactory->addPropertyManager(manager); - const QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); + const auto datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); for (QtDatePropertyManager *manager : datePropertyManagers) d_ptr->m_dateEditFactory->addPropertyManager(manager); - const QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); + const auto timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); for (QtTimePropertyManager *manager : timePropertyManagers) d_ptr->m_timeEditFactory->addPropertyManager(manager); - const QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); + const auto dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); for (QtDateTimePropertyManager *manager : dateTimePropertyManagers) d_ptr->m_dateTimeEditFactory->addPropertyManager(manager); - const QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); + const auto keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); for (QtKeySequencePropertyManager *manager : keySequencePropertyManagers) d_ptr->m_keySequenceEditorFactory->addPropertyManager(manager); - const QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); + const auto charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); for (QtCharPropertyManager *manager : charPropertyManagers) d_ptr->m_charEditorFactory->addPropertyManager(manager); - const QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); + const auto localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); for (QtLocalePropertyManager *manager : localePropertyManagers) d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); - const QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); + const auto pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); for (QtPointPropertyManager *manager : pointPropertyManagers) d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); - const QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); + const auto pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); for (QtPointFPropertyManager *manager : pointFPropertyManagers) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager->subDoublePropertyManager()); - const QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); + const auto sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); for (QtSizePropertyManager *manager : sizePropertyManagers) d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); - const QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); + const auto sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); for (QtSizeFPropertyManager *manager : sizeFPropertyManagers) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager->subDoublePropertyManager()); - const QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); + const auto rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); for (QtRectPropertyManager *manager : rectPropertyManagers) d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); - const QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); + const auto rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); for (QtRectFPropertyManager *manager : rectFPropertyManagers) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(manager->subDoublePropertyManager()); - const QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); + const auto colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); for (QtColorPropertyManager *manager : colorPropertyManagers) { d_ptr->m_colorEditorFactory->addPropertyManager(manager); d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); } - const QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); + const auto enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); for (QtEnumPropertyManager *manager : enumPropertyManagers) d_ptr->m_comboBoxFactory->addPropertyManager(manager); - const QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); + const auto sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); for (QtSizePolicyPropertyManager *manager : sizePolicyPropertyManagers) { d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); } - const QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); + const auto fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); for (QtFontPropertyManager *manager : fontPropertyManagers) { d_ptr->m_fontEditorFactory->addPropertyManager(manager); d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); @@ -2081,11 +2081,11 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager()); } - const QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); + const auto cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); for (QtCursorPropertyManager *manager : cursorPropertyManagers) d_ptr->m_cursorEditorFactory->addPropertyManager(manager); - const QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); + const auto flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); for (QtFlagPropertyManager *manager : flagPropertyManagers) d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager()); } @@ -2112,87 +2112,87 @@ QWidget *QtVariantEditorFactory::createEditor(QtVariantPropertyManager *manager, */ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager *manager) { - const QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); + const auto intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); for (QtIntPropertyManager *manager : intPropertyManagers) d_ptr->m_spinBoxFactory->removePropertyManager(manager); - const QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); + const auto doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); for (QtDoublePropertyManager *manager : doublePropertyManagers) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager); - const QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); + const auto boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); for (QtBoolPropertyManager *manager : boolPropertyManagers) d_ptr->m_checkBoxFactory->removePropertyManager(manager); - const QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); + const auto stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); for (QtStringPropertyManager *manager : stringPropertyManagers) d_ptr->m_lineEditFactory->removePropertyManager(manager); - const QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); + const auto datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); for (QtDatePropertyManager *manager : datePropertyManagers) d_ptr->m_dateEditFactory->removePropertyManager(manager); - const QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); + const auto timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); for (QtTimePropertyManager *manager : timePropertyManagers) d_ptr->m_timeEditFactory->removePropertyManager(manager); - const QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); + const auto dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); for (QtDateTimePropertyManager *manager : dateTimePropertyManagers) d_ptr->m_dateTimeEditFactory->removePropertyManager(manager); - const QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); + const auto keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); for (QtKeySequencePropertyManager *manager : keySequencePropertyManagers) d_ptr->m_keySequenceEditorFactory->removePropertyManager(manager); - const QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); + const auto charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); for (QtCharPropertyManager *manager : charPropertyManagers) d_ptr->m_charEditorFactory->removePropertyManager(manager); - const QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); + const auto localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); for (QtLocalePropertyManager *manager : localePropertyManagers) d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); - const QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); + const auto pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); for (QtPointPropertyManager *manager : pointPropertyManagers) d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); - const QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); + const auto pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); for (QtPointFPropertyManager *manager : pointFPropertyManagers) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager->subDoublePropertyManager()); - const QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); + const auto sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); for (QtSizePropertyManager *manager : sizePropertyManagers) d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); - const QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); + const auto sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); for (QtSizeFPropertyManager *manager : sizeFPropertyManagers) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager->subDoublePropertyManager()); - const QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); + const auto rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); for (QtRectPropertyManager *manager : rectPropertyManagers) d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); - const QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); + const auto rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); for (QtRectFPropertyManager *manager : rectFPropertyManagers) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(manager->subDoublePropertyManager()); - const QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); + const auto colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); for (QtColorPropertyManager *manager : colorPropertyManagers) { d_ptr->m_colorEditorFactory->removePropertyManager(manager); d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); } - const QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); + const auto enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); for (QtEnumPropertyManager *manager : enumPropertyManagers) d_ptr->m_comboBoxFactory->removePropertyManager(manager); - const QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); + const auto sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); for (QtSizePolicyPropertyManager *manager : sizePolicyPropertyManagers) { d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); } - const QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); + const auto fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); for (QtFontPropertyManager *manager : fontPropertyManagers) { d_ptr->m_fontEditorFactory->removePropertyManager(manager); d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); @@ -2200,11 +2200,11 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager()); } - const QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); + const auto cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); for (QtCursorPropertyManager *manager : cursorPropertyManagers) d_ptr->m_cursorEditorFactory->removePropertyManager(manager); - const QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); + const auto flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); for (QtFlagPropertyManager *manager : flagPropertyManagers) d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager()); } diff --git a/src/shared/qttoolbardialog/qttoolbardialog.cpp b/src/shared/qttoolbardialog/qttoolbardialog.cpp index 3e9363b93..58f317fd3 100644 --- a/src/shared/qttoolbardialog/qttoolbardialog.cpp +++ b/src/shared/qttoolbardialog/qttoolbardialog.cpp @@ -173,14 +173,14 @@ QToolBar *QtFullToolBarManagerPrivate::toolBarWidgetAction(QAction *action) cons void QtFullToolBarManagerPrivate::removeWidgetActions(const QMap<QToolBar *, QList<QAction *> > &actions) { - QMap<QToolBar *, QList<QAction *> >::ConstIterator itToolBar = actions.constBegin(); + auto itToolBar = actions.constBegin(); while (itToolBar != actions.constEnd()) { QToolBar *toolBar = itToolBar.key(); - QList<QAction *> newActions = toolBars.value(toolBar); - QList<QAction *> newActionsWithSeparators = toolBarsWithSeparators.value(toolBar); + auto newActions = toolBars.value(toolBar); + auto newActionsWithSeparators = toolBarsWithSeparators.value(toolBar); QList<QAction *> removedActions; - const QList<QAction *> actionList = itToolBar.value(); + const auto actionList = itToolBar.value(); for (QAction *action : actionList) { if (newActions.contains(action) && toolBarWidgetAction(action) == toolBar) { newActions.removeAll(action); @@ -206,8 +206,7 @@ void QtFullToolBarManagerPrivate::saveState(QDataStream &stream) const { stream << (uchar) ToolBarMarker; stream << defaultToolBars.size(); - QMap<QToolBar *, QList<QAction *> >::ConstIterator itToolBar = - defaultToolBars.constBegin(); + auto itToolBar = defaultToolBars.constBegin(); while (itToolBar != defaultToolBars.constEnd()) { QToolBar *tb = itToolBar.key(); if (tb->objectName().isEmpty()) { @@ -219,7 +218,7 @@ void QtFullToolBarManagerPrivate::saveState(QDataStream &stream) const stream << tb->objectName(); } - const QList<QAction *> actions = toolBars.value(tb); + const auto actions = toolBars.value(tb); stream << actions.size(); for (QAction *action : actions) { if (action) { @@ -250,7 +249,7 @@ void QtFullToolBarManagerPrivate::saveState(QDataStream &stream) const stream << toolBars[tb].size(); - const QList<QAction *> actions = toolBars.value(tb); + const auto actions = toolBars.value(tb); for (QAction *action : actions) { if (action) { if (action->objectName().isEmpty()) { @@ -310,7 +309,7 @@ bool QtFullToolBarManagerPrivate::restoreState(QDataStream &stream) const if (ctmarker != CustomToolBarMarker) return false; - QList<QToolBar *> oldCustomToolBars = customToolBars; + auto oldCustomToolBars = customToolBars; stream >> toolBars; for (int i = 0; i < toolBars; i++) { @@ -353,8 +352,7 @@ bool QtFullToolBarManagerPrivate::restoreState(QDataStream &stream) const QToolBar *QtFullToolBarManagerPrivate::findDefaultToolBar(const QString &objectName) const { - QMap<QToolBar *, QList<QAction *> >::ConstIterator itToolBar = - defaultToolBars.constBegin(); + auto itToolBar = defaultToolBars.constBegin(); while (itToolBar != defaultToolBars.constEnd()) { QToolBar *tb = itToolBar.key(); if (tb->objectName() == objectName) @@ -406,7 +404,7 @@ QAction *QtFullToolBarManagerPrivate::findAction(const QString &actionName) cons QToolBar *QtFullToolBarManagerPrivate::toolBarByName(const QString &toolBarName) const { - QMap<QToolBar *, QList<QAction *> >::ConstIterator itToolBar = toolBars.constBegin(); + auto itToolBar = toolBars.constBegin(); while (itToolBar != toolBars.constEnd()) { QToolBar *toolBar = itToolBar.key(); if (toolBar->objectName() == toolBarName) @@ -456,11 +454,10 @@ QStringList QtFullToolBarManager::categories() const QList<QAction *> QtFullToolBarManager::categoryActions(const QString &category) const { - QMap<QString, QList<QAction *> >::ConstIterator it = - d_ptr->categoryToActions.find(category); + const auto it = d_ptr->categoryToActions.constFind(category); if (it != d_ptr->categoryToActions.constEnd()) return it.value(); - return QList<QAction *>(); + return {}; } QString QtFullToolBarManager::actionCategory(QAction *action) const @@ -494,7 +491,7 @@ void QtFullToolBarManager::removeAction(QAction *action) if (!d_ptr->allActions.contains(action)) return; - const QList<QToolBar *> toolBars = d_ptr->actionToToolBars[action]; + const auto toolBars = d_ptr->actionToToolBars[action]; for (QToolBar *toolBar : toolBars) { d_ptr->toolBars[toolBar].removeAll(action); d_ptr->toolBarsWithSeparators[toolBar].removeAll(action); @@ -502,8 +499,7 @@ void QtFullToolBarManager::removeAction(QAction *action) toolBar->removeAction(action); } - QMap<QToolBar *, QList<QAction *> >::ConstIterator itDefault = - d_ptr->defaultToolBars.constBegin(); + auto itDefault = d_ptr->defaultToolBars.constBegin(); while (itDefault != d_ptr->defaultToolBars.constEnd()) { if (itDefault.value().contains(action)) d_ptr->defaultToolBars[itDefault.key()].removeAll(action); @@ -546,7 +542,7 @@ void QtFullToolBarManager::addDefaultToolBar(QToolBar *toolBar, const QString &c QList<QAction *> newActionsWithSeparators; QList<QAction *> newActions; - const QList<QAction *> actions = toolBar->actions(); + const auto actions = toolBar->actions(); for (QAction *action : actions) { addAction(action, category); if (d_ptr->widgetActions.contains(action)) @@ -569,7 +565,7 @@ void QtFullToolBarManager::removeDefaultToolBar(QToolBar *toolBar) if (!d_ptr->defaultToolBars.contains(toolBar)) return; - const QList<QAction *> defaultActions = d_ptr->defaultToolBars[toolBar]; + const auto defaultActions = d_ptr->defaultToolBars[toolBar]; setToolBar(toolBar, QList<QAction *>()); for (QAction *action : defaultActions) removeAction(action); @@ -638,7 +634,7 @@ QList<QAction *> QtFullToolBarManager::actions(QToolBar *toolBar) const void QtFullToolBarManager::setToolBars(const QMap<QToolBar *, QList<QAction *> > &actions) { - QMap<QToolBar *, QList<QAction *> >::ConstIterator it = actions.constBegin(); + auto it = actions.constBegin(); while (it != actions.constEnd()) { setToolBar(it.key(), it.value()); ++it; @@ -669,7 +665,7 @@ void QtFullToolBarManager::setToolBar(QToolBar *toolBar, const QList<QAction *> d_ptr->removeWidgetActions(toRemove); - const QList<QAction *> oldActions = d_ptr->toolBarsWithSeparators.value(toolBar); + const auto oldActions = d_ptr->toolBarsWithSeparators.value(toolBar); for (QAction *action : oldActions) { /* When addDefaultToolBar() separator actions could be checked if they are @@ -715,7 +711,7 @@ void QtFullToolBarManager::resetToolBar(QToolBar *toolBar) void QtFullToolBarManager::resetAllToolBars() { setToolBars(defaultToolBars()); - const QList<QToolBar *> oldCustomToolBars = d_ptr->customToolBars; + const auto oldCustomToolBars = d_ptr->customToolBars; for (QToolBar *tb : oldCustomToolBars) deleteToolBar(tb); } @@ -1097,7 +1093,7 @@ void QtToolBarDialogPrivate::fillNew() for (const QString &category : categories) { QTreeWidgetItem *categoryItem = new QTreeWidgetItem(ui.actionTree); categoryItem->setText(0, category); - const QList<QAction *> actions = toolBarManager->categoryActions(category); + const auto actions = toolBarManager->categoryActions(category); for (QAction *action : actions) { item = new QTreeWidgetItem(categoryItem); item->setText(0, action->text()); @@ -1115,8 +1111,8 @@ void QtToolBarDialogPrivate::fillNew() } //ui.actionTree->sortItems(0, Qt::AscendingOrder); - QMap<QToolBar *, QList<QAction *> > toolBars = toolBarManager->toolBarsActions(); - QMap<QToolBar *, QList<QAction *> >::ConstIterator it = toolBars.constBegin(); + const auto toolBars = toolBarManager->toolBarsActions(); + auto it = toolBars.constBegin(); while (it != toolBars.constEnd()) { QToolBar *toolBar = it.key(); ToolBarItem *tbItem = createItem(toolBar); @@ -1125,7 +1121,7 @@ void QtToolBarDialogPrivate::fillNew() ui.toolBarList); toolBarToItem.insert(tbItem, item); itemToToolBar.insert(item, tbItem); - const QList<QAction *> actions = it.value(); + const auto actions = it.value(); for (QAction *action : actions) { if (toolBarManager->isWidgetAction(action)) { widgetActionToToolBar.insert(action, tbItem); @@ -1257,8 +1253,8 @@ void QtToolBarDialogPrivate::removeClicked() void QtToolBarDialogPrivate::defaultClicked() { - QMap<QToolBar *, QList<QAction *> > defaultToolBars = toolBarManager->defaultToolBars(); - QMap<QToolBar *, QList<QAction *> >::ConstIterator itToolBar = defaultToolBars.constBegin(); + const auto defaultToolBars = toolBarManager->defaultToolBars(); + auto itToolBar = defaultToolBars.constBegin(); while (itToolBar != defaultToolBars.constEnd()) { QToolBar *toolBar = itToolBar.key(); ToolBarItem *toolBarItem = toolBarItems.value(toolBar); @@ -1289,7 +1285,7 @@ void QtToolBarDialogPrivate::defaultClicked() } currentToolBarChanged(toolBarToItem.value(currentToolBar)); - const QList<ToolBarItem *> toolBars = currentState.keys(); + const auto toolBars = currentState.keys(); for (ToolBarItem *tb : toolBars) removeToolBar(tb); } @@ -1302,8 +1298,8 @@ void QtToolBarDialogPrivate::okClicked() void QtToolBarDialogPrivate::applyClicked() { - QMap<ToolBarItem *, QList<QAction *> > toolBars = currentState; - QMap<ToolBarItem *, QList<QAction *> >::ConstIterator itToolBar = toolBars.constBegin(); + const auto toolBars = currentState; + auto itToolBar = toolBars.constBegin(); while (itToolBar != toolBars.constEnd()) { ToolBarItem *item = itToolBar.key(); QToolBar *toolBar = item->toolBar(); @@ -1329,7 +1325,7 @@ void QtToolBarDialogPrivate::applyClicked() for (ToolBarItem *item : toCreate) { QString toolBarName = item->toolBarName(); createdItems.remove(item); - QList<QAction *> actions = currentState.value(item); + const auto actions = currentState.value(item); QToolBar *toolBar = toolBarManager->createToolBar(toolBarName); item->setToolBar(toolBar); toolBarManager->setToolBar(toolBar, actions); @@ -1347,7 +1343,7 @@ void QtToolBarDialogPrivate::upClicked() ui.currentToolBarList->takeItem(row); int newRow = row - 1; ui.currentToolBarList->insertItem(newRow, currentToolBarAction); - QList<QAction *> actions = currentState.value(currentToolBar); + auto actions = currentState.value(currentToolBar); QAction *action = actions.at(row); actions.removeAt(row); actions.insert(newRow, action); @@ -1367,7 +1363,7 @@ void QtToolBarDialogPrivate::downClicked() ui.currentToolBarList->takeItem(row); int newRow = row + 1; ui.currentToolBarList->insertItem(newRow, currentToolBarAction); - QList<QAction *> actions = currentState.value(currentToolBar); + auto actions = currentState.value(currentToolBar); QAction *action = actions.at(row); actions.removeAt(row); actions.insert(newRow, action); @@ -1500,7 +1496,7 @@ void QtToolBarDialogPrivate::currentToolBarChanged(QListWidgetItem *current) if (!currentToolBar) { return; } - const QList<QAction *> actions = currentState.value(currentToolBar); + const auto actions = currentState.value(currentToolBar); QListWidgetItem *first = 0; for (QAction *action : actions) { QString actionName = separatorText; |