diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-12-15 10:02:05 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-12-15 14:14:27 +0100 |
commit | 36ae08faf04ec68f75f4f0ac9454cee2351f871e (patch) | |
tree | a0645b160ba3e4ee227ad0ede7301033eb742691 | |
parent | c7b25190d804f0a6751b57b2e4694976b2d2f6f0 (diff) |
Qt Designer: port away from QPair
Add fixme comment for public API.
Pick-to: 6.7
Task-number: QTBUG-115841
Change-Id: Id518638b7112b68d5cbbcbb2b66ec9dbb7e3108b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
37 files changed, 123 insertions, 118 deletions
diff --git a/src/designer/src/components/formeditor/formwindow.h b/src/designer/src/components/formeditor/formwindow.h index 42071cd17..c9aefee37 100644 --- a/src/designer/src/components/formeditor/formwindow.h +++ b/src/designer/src/components/formeditor/formwindow.h @@ -14,6 +14,8 @@ #include <QtCore/qset.h> #include <QtCore/qpointer.h> +#include <utility> + QT_BEGIN_NAMESPACE class QDesignerDnDItemInterface; @@ -314,7 +316,7 @@ private: QString m_fileName; - using PaletteAndFill = QPair<QPalette ,bool>; + using PaletteAndFill = std::pair<QPalette, bool>; QHash<QWidget *, PaletteAndFill> m_palettesBeforeHighlight; QRubberBand *m_rubberBand = nullptr; diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp index 728b05d46..2b63d3bc1 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp @@ -250,7 +250,7 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory } if (value.canConvert<PropertySheetIconValue>()) { const PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(value); - const QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> pixmaps = icon.paths(); + const auto &pixmaps = icon.paths(); const QString theme = icon.theme(); if (!pixmaps.isEmpty() || !theme.isEmpty()) { DomResourceIcon *ri = new DomResourceIcon; diff --git a/src/designer/src/components/formeditor/qmainwindow_container.cpp b/src/designer/src/components/formeditor/qmainwindow_container.cpp index d4bd19d49..d4c85bc75 100644 --- a/src/designer/src/components/formeditor/qmainwindow_container.cpp +++ b/src/designer/src/components/formeditor/qmainwindow_container.cpp @@ -48,7 +48,7 @@ void QMainWindowContainer::setCurrentIndex(int index) namespace { // Pair of <area,break_before> - using ToolBarData = QPair<Qt::ToolBarArea,bool> ; + using ToolBarData = std::pair<Qt::ToolBarArea, bool>; ToolBarData toolBarData(QToolBar *me) { const QMainWindow *mw = qobject_cast<const QMainWindow*>(me->parentWidget()); diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp index 9680ecc14..4344a434f 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -1082,7 +1082,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(iconProperty->value()); const auto itState = m_iconSubPropertyToState.constFind(property); if (itState != m_iconSubPropertyToState.constEnd()) { - QPair<QIcon::Mode, QIcon::State> pair = m_iconSubPropertyToState.value(property); + const auto pair = m_iconSubPropertyToState.value(property); icon.setPixmap(pair.first, pair.second, qvariant_cast<PropertySheetPixmapValue>(value)); } else { // must be theme property icon.setTheme(value.toString()); @@ -1120,8 +1120,8 @@ void DesignerPropertyManager::slotPropertyDestroyed(QtProperty *property) m_propertyToTheme.remove(iconProperty); } else { const auto it = m_propertyToIconSubProperties.find(iconProperty); - QPair<QIcon::Mode, QIcon::State> state = m_iconSubPropertyToState.value(property); - QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> &propertyList = it.value(); + const auto state = m_iconSubPropertyToState.value(property); + auto &propertyList = it.value(); propertyList.remove(state); m_iconSubPropertyToState.remove(property); } @@ -1279,7 +1279,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property, QList<uint> values; - for (const QPair<QString, uint> &pair : flags) { + for (const auto &pair : flags) { const QString flagName = pair.first; QtProperty *prop = addProperty(QMetaType::Bool); prop->setPropertyName(flagName); @@ -1403,9 +1403,9 @@ void DesignerPropertyManager::setAttribute(QtProperty *property, qdesigner_internal::PropertySheetIconValue icon = m_iconValues.value(property); if (icon.paths().isEmpty()) { - QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> subIconProperties = m_propertyToIconSubProperties.value(property); + const auto &subIconProperties = m_propertyToIconSubProperties.value(property); for (auto itSub = subIconProperties.cbegin(), end = subIconProperties.cend(); itSub != end; ++itSub) { - QPair<QIcon::Mode, QIcon::State> pair = itSub.key(); + const auto pair = itSub.key(); QtProperty *subProp = itSub.value(); setAttribute(subProp, QLatin1StringView(defaultResourceAttributeC), defaultIcon.pixmap(16, 16, pair.first, pair.second)); @@ -1543,7 +1543,7 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const if (!theme.isEmpty() && QIcon::hasThemeIcon(theme)) return tr("[Theme] %1").arg(theme); const auto &paths = icon.paths(); - const auto it = paths.constFind(qMakePair(QIcon::Normal, QIcon::Off)); + const auto it = paths.constFind({QIcon::Normal, QIcon::Off}); if (it == paths.constEnd()) return QString(); return QFileInfo(it.value().path()).fileName(); @@ -1613,9 +1613,9 @@ void DesignerPropertyManager::reloadResourceProperties() defaultIcon = iconCache->icon(icon); } - QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> subProperties = m_propertyToIconSubProperties.value(property); + const auto &subProperties = m_propertyToIconSubProperties.value(property); for (auto itSub = subProperties.cbegin(), end = subProperties.cend(); itSub != end; ++itSub) { - const QPair<QIcon::Mode, QIcon::State> pair = itSub.key(); + const auto pair = itSub.key(); QtVariantProperty *subProperty = variantProperty(itSub.value()); subProperty->setAttribute(QLatin1StringView(defaultResourceAttributeC), defaultIcon.pixmap(16, 16, pair.first, pair.second)); @@ -1862,9 +1862,9 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val const auto &iconPaths = icon.paths(); - QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> subProperties = m_propertyToIconSubProperties.value(property); + const auto &subProperties = m_propertyToIconSubProperties.value(property); for (auto itSub = subProperties.cbegin(), end = subProperties.cend(); itSub != end; ++itSub) { - const QPair<QIcon::Mode, QIcon::State> pair = itSub.key(); + const auto pair = itSub.key(); QtVariantProperty *subProperty = variantProperty(itSub.value()); bool hasPath = iconPaths.contains(pair); subProperty->setModified(hasPath); @@ -1883,7 +1883,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val emit propertyChanged(property); QString toolTip; - const auto itNormalOff = iconPaths.constFind(qMakePair(QIcon::Normal, QIcon::Off)); + const auto itNormalOff = iconPaths.constFind({QIcon::Normal, QIcon::Off}); if (itNormalOff != iconPaths.constEnd()) toolTip = itNormalOff.value().path(); // valueText() only show the file name; show full path as ToolTip. @@ -2102,7 +2102,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property) void DesignerPropertyManager::createIconSubProperty(QtProperty *iconProperty, QIcon::Mode mode, QIcon::State state, const QString &subName) { - QPair<QIcon::Mode, QIcon::State> pair = qMakePair(mode, state); + const auto pair = std::make_pair(mode, state); QtVariantProperty *subProp = addProperty(DesignerPropertyManager::designerPixmapTypeId(), subName); m_propertyToIconSubProperties[iconProperty][pair] = subProp; m_iconSubPropertyToState[subProp] = pair; @@ -2159,7 +2159,7 @@ void DesignerPropertyManager::uninitializeProperty(QtProperty *property) m_pixmapValues.remove(property); m_defaultPixmaps.remove(property); - QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> iconSubProperties = m_propertyToIconSubProperties.value(property); + const auto &iconSubProperties = m_propertyToIconSubProperties.value(property); for (auto itIcon = iconSubProperties.cbegin(), end = iconSubProperties.cend(); itIcon != end; ++itIcon) { QtProperty *subIcon = itIcon.value(); delete subIcon; diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.h b/src/designer/src/components/propertyeditor/designerpropertymanager.h index 34900cb21..962a3bcf7 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.h +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h @@ -18,7 +18,7 @@ QT_BEGIN_NAMESPACE -using DesignerIntPair = QPair<QString, uint>; +using DesignerIntPair = std::pair<QString, uint>; using DesignerFlagList = QList<DesignerIntPair>; class QDesignerFormEditorInterface; @@ -179,8 +179,8 @@ private: PropertyToPropertyMap m_alignVToProperty; QHash<const QtProperty *, Qt::Alignment> m_alignDefault; - QHash<QtProperty *, QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *>> m_propertyToIconSubProperties; - QHash<QtProperty *, QPair<QIcon::Mode, QIcon::State>> m_iconSubPropertyToState; + QHash<QtProperty *, QMap<std::pair<QIcon::Mode, QIcon::State>, QtProperty *>> m_propertyToIconSubProperties; + QHash<QtProperty *, std::pair<QIcon::Mode, QIcon::State>> m_iconSubPropertyToState; PropertyToPropertyMap m_iconSubPropertyToProperty; PropertyToPropertyMap m_propertyToTheme; diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp index 4226f3c12..b06827f21 100644 --- a/src/designer/src/components/propertyeditor/propertyeditor.cpp +++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp @@ -196,11 +196,11 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare const int darknessFactor = 250; m_colors.reserve(std::size(colors)); for (const QColor &c : colors) - m_colors.push_back(qMakePair(c, c.darker(darknessFactor))); + m_colors.append({c, c.darker(darknessFactor)}); QColor dynamicColor(191, 207, 255); QColor layoutColor(255, 191, 191); - m_dynamicColor = qMakePair(dynamicColor, dynamicColor.darker(darknessFactor)); - m_layoutColor = qMakePair(layoutColor, layoutColor.darker(darknessFactor)); + m_dynamicColor = {dynamicColor, dynamicColor.darker(darknessFactor)}; + m_layoutColor = {layoutColor, layoutColor.darker(darknessFactor)}; updateForegroundBrightness(); @@ -542,7 +542,7 @@ QColor PropertyEditor::propertyColor(QtProperty *property) const groupProperty = m_nameToGroup.value(itProp.value()); const int groupIdx = m_groups.indexOf(groupProperty); - QPair<QColor, QColor> pair; + std::pair<QColor, QColor> pair; if (groupIdx != -1) { if (groupProperty == m_dynamicGroup) pair = m_dynamicColor; @@ -973,10 +973,10 @@ void PropertyEditor::setObject(QObject *object) m_updatingBrowser = false; } else if (type == DesignerPropertyManager::designerFlagTypeId()) { const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(value); - QList<QPair<QString, uint> > flags; + QList<std::pair<QString, uint>> flags; for (const QString &name : f.metaFlags.keys()) { const uint val = f.metaFlags.keyToValue(name); - flags.append(qMakePair(name, val)); + flags.append({name, val}); } m_updatingBrowser = true; QVariant v; diff --git a/src/designer/src/components/propertyeditor/propertyeditor.h b/src/designer/src/components/propertyeditor/propertyeditor.h index 45c468c16..48cd03b25 100644 --- a/src/designer/src/components/propertyeditor/propertyeditor.h +++ b/src/designer/src/components/propertyeditor/propertyeditor.h @@ -155,9 +155,9 @@ private: QMap<QString, bool> m_expansionState; QString m_filterPattern; - QList<QPair<QColor, QColor> > m_colors; - QPair<QColor, QColor> m_dynamicColor; - QPair<QColor, QColor> m_layoutColor; + QList<std::pair<QColor, QColor> > m_colors; + std::pair<QColor, QColor> m_dynamicColor; + std::pair<QColor, QColor> m_layoutColor; bool m_brightness = false; }; diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp index 0625e484f..f8db32ee3 100644 --- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -17,7 +17,7 @@ QT_BEGIN_NAMESPACE -using ClassNameSignaturePair = QPair<QString, QString>; +using ClassNameSignaturePair = std::pair<QString, QString>; // Find all member functions that match a predicate on the signature string // using the member sheet and the fake methods stored in the widget diff --git a/src/designer/src/designer/appfontdialog.cpp b/src/designer/src/designer/appfontdialog.cpp index f70c3c9b4..0379a1d90 100644 --- a/src/designer/src/designer/appfontdialog.cpp +++ b/src/designer/src/designer/appfontdialog.cpp @@ -59,7 +59,7 @@ public: bool removeAt(int index, QString *errorMessage); // Store loaded fonts as pair of file name and Id - using FileNameFontIdPair = QPair<QString,int>; + using FileNameFontIdPair = std::pair<QString, int>; using FileNameFontIdPairs = QList<FileNameFontIdPair>; const FileNameFontIdPairs &fonts() const; diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp index aee316522..c7193c2f3 100644 --- a/src/designer/src/lib/extension/default_extensionfactory.cpp +++ b/src/designer/src/lib/extension/default_extensionfactory.cpp @@ -77,7 +77,7 @@ QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const { if (!object) return nullptr; - const auto key = qMakePair(iid, object); + const auto key = std::make_pair(iid, object); auto it = m_extensions.find(key); if (it == m_extensions.end()) { diff --git a/src/designer/src/lib/extension/default_extensionfactory.h b/src/designer/src/lib/extension/default_extensionfactory.h index 795d55d7a..825b9d5a1 100644 --- a/src/designer/src/lib/extension/default_extensionfactory.h +++ b/src/designer/src/lib/extension/default_extensionfactory.h @@ -32,7 +32,7 @@ protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; private: - mutable QMap<QPair<QString, QObject *>, QObject *> m_extensions; + mutable QMap<std::pair<QString, QObject *>, QObject *> m_extensions; // ### FIXME Qt 7: Use QSet, add out of line destructor. mutable QHash<QObject*, bool> m_extended; }; diff --git a/src/designer/src/lib/sdk/layoutdecoration.qdoc b/src/designer/src/lib/sdk/layoutdecoration.qdoc index e2ec73438..8f98af168 100644 --- a/src/designer/src/lib/sdk/layoutdecoration.qdoc +++ b/src/designer/src/lib/sdk/layoutdecoration.qdoc @@ -1,6 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only +// ### FIXME Qt 7: std::pair in QDesignerLayoutDecorationExtension (QTBUG-115841) + /*! \class QDesignerLayoutDecorationExtension \brief The QDesignerLayoutDecorationExtension class provides an extension to a layout in \QD. diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp index 81def02e6..17255aa56 100644 --- a/src/designer/src/lib/shared/formlayoutmenu.cpp +++ b/src/designer/src/lib/shared/formlayoutmenu.cpp @@ -376,15 +376,15 @@ static QFormLayout *managedFormLayout(const QDesignerFormEditorInterface *core, // Create the widgets of a control row and apply text properties contained // in the struct, called by addFormLayoutRow() -static QPair<QWidget *,QWidget *> +static std::pair<QWidget *,QWidget *> createWidgets(const FormLayoutRow &row, QWidget *parent, QDesignerFormWindowInterface *formWindow) { QDesignerFormEditorInterface *core = formWindow->core(); QDesignerWidgetFactoryInterface *wf = core->widgetFactory(); - QPair<QWidget *,QWidget *> rc{wf->createWidget(u"QLabel"_s, parent), - wf->createWidget(row.fieldClassName, parent)}; + std::pair<QWidget *,QWidget *> rc{wf->createWidget(u"QLabel"_s, parent), + wf->createWidget(row.fieldClassName, parent)}; // Set up properties of the label const QString objectNameProperty = u"objectName"_s; QDesignerPropertySheetExtension *labelSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), rc.first); @@ -416,7 +416,7 @@ static void addFormLayoutRow(const FormLayoutRow &formLayoutRow, int row, QWidge undoStack->beginMacro(macroName); // Create a list of widget insertion commands and pass them a cell position - const QPair<QWidget *,QWidget *> widgetPair = createWidgets(formLayoutRow, w, formWindow); + const auto widgetPair = createWidgets(formLayoutRow, w, formWindow); InsertWidgetCommand *labelCmd = new InsertWidgetCommand(formWindow); labelCmd->init(widgetPair.first, false, row, 0); diff --git a/src/designer/src/lib/shared/newformwidget_p.h b/src/designer/src/lib/shared/newformwidget_p.h index 235bbc4ee..d9acbd2a3 100644 --- a/src/designer/src/lib/shared/newformwidget_p.h +++ b/src/designer/src/lib/shared/newformwidget_p.h @@ -87,7 +87,7 @@ private: bool showCurrentItemPixmap(); // Pixmap cache (item, profile combo index) - using ItemPixmapCacheKey = QPair<const QTreeWidgetItem *, int>; + using ItemPixmapCacheKey = std::pair<const QTreeWidgetItem *, int>; using ItemPixmapCache = QMap<ItemPixmapCacheKey, QPixmap>; ItemPixmapCache m_itemPixmapCache; diff --git a/src/designer/src/lib/shared/pluginmanager.cpp b/src/designer/src/lib/shared/pluginmanager.cpp index 1fedb3980..e40c02e11 100644 --- a/src/designer/src/lib/shared/pluginmanager.cpp +++ b/src/designer/src/lib/shared/pluginmanager.cpp @@ -100,7 +100,7 @@ static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core) class QDesignerCustomWidgetSharedData : public QSharedData { public: // Type of a string property - using StringPropertyType = QPair<qdesigner_internal::TextPropertyValidationMode, bool>; + using StringPropertyType = std::pair<qdesigner_internal::TextPropertyValidationMode, bool>; explicit QDesignerCustomWidgetSharedData(const QString &thePluginPath) : pluginPath(thePluginPath) {} void clearXML(); @@ -417,7 +417,7 @@ QDesignerCustomWidgetData::ParseResult class QDesignerPluginManagerPrivate { public: - using ClassNamePropertyNameKey = QPair<QString, QString>; + using ClassNamePropertyNameKey = std::pair<QString, QString>; QDesignerPluginManagerPrivate(QDesignerFormEditorInterface *core); diff --git a/src/designer/src/lib/shared/pluginmanager_p.h b/src/designer/src/lib/shared/pluginmanager_p.h index 588b1e15a..be0f4bfd7 100644 --- a/src/designer/src/lib/shared/pluginmanager_p.h +++ b/src/designer/src/lib/shared/pluginmanager_p.h @@ -36,7 +36,7 @@ class QDesignerCustomWidgetSharedData; class QDESIGNER_SHARED_EXPORT QDesignerCustomWidgetData { public: // StringPropertyType: validation mode and translatable flag. - using StringPropertyType = QPair<qdesigner_internal::TextPropertyValidationMode, bool>; + using StringPropertyType = std::pair<qdesigner_internal::TextPropertyValidationMode, bool>; explicit QDesignerCustomWidgetData(const QString &pluginPath = QString()); diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp index 2deff263f..e89d6a4aa 100644 --- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp +++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp @@ -33,7 +33,7 @@ using namespace Qt::StringLiterals; static const char skinExtensionC[] = "skin"; // Pair of skin name, path -using SkinNamePath = QPair<QString, QString>; +using SkinNamePath = std::pair<QString, QString>; using Skins = QList<SkinNamePath>; enum { SkinComboNoneIndex = 0 }; diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp index 04e100394..2633224e6 100644 --- a/src/designer/src/lib/shared/qdesigner_command.cpp +++ b/src/designer/src/lib/shared/qdesigner_command.cpp @@ -121,7 +121,7 @@ void InsertWidgetCommand::init(QWidget *widget, bool already_in_form, int layout m_cell.first = layoutRow; m_cell.second = layoutColumn; } else { - m_cell = deco ? deco->currentCell() : qMakePair(0, 0); + m_cell = deco ? deco->currentCell() : std::make_pair(0, 0); } m_widgetWasManaged = already_in_form; } diff --git a/src/designer/src/lib/shared/qdesigner_command_p.h b/src/designer/src/lib/shared/qdesigner_command_p.h index 40520f4b8..e3239ce5c 100644 --- a/src/designer/src/lib/shared/qdesigner_command_p.h +++ b/src/designer/src/lib/shared/qdesigner_command_p.h @@ -84,7 +84,7 @@ private: QPointer<QWidget> m_widget; QDesignerLayoutDecorationExtension::InsertMode m_insertMode; - QPair<int, int> m_cell; + std::pair<int, int> m_cell; LayoutHelper* m_layoutHelper; bool m_widgetWasManaged; }; @@ -864,7 +864,7 @@ struct QDESIGNER_SHARED_EXPORT ListContents { // methods to retrieve and apply for ChangeTableContentsCommand struct QDESIGNER_SHARED_EXPORT TableWidgetContents { - using CellRowColumnAddress = QPair<int, int>; + using CellRowColumnAddress = std::pair<int, int>; TableWidgetContents(); void clear(); diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp index 82a46dc64..f24675e7b 100644 --- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp @@ -881,7 +881,7 @@ QVariant PropertyHelper::findDefaultValue(QDesignerFormWindowInterface *fw) cons PropertyHelper::Value PropertyHelper::restoreDefaultValue(QDesignerFormWindowInterface *fw) { - Value defaultValue = qMakePair(QVariant(), false); + Value defaultValue{{}, false}; const QVariant currentValue = m_propertySheet->property(m_index); // try to reset sheet, else try to find default if (m_propertySheet->reset(m_index)) { @@ -1458,7 +1458,8 @@ bool RemoveDynamicPropertyCommand::init(const QObjectList &selection, QObject *c if (!dynamicSheet->isDynamicProperty(index)) return false; - m_objectToValueAndChanged[current] = qMakePair(propertySheet->property(index), propertySheet->isChanged(index)); + m_objectToValueAndChanged[current] = {propertySheet->property(index), + propertySheet->isChanged(index)}; for (QObject *obj : selection) { if (m_objectToValueAndChanged.contains(obj)) @@ -1468,7 +1469,8 @@ bool RemoveDynamicPropertyCommand::init(const QObjectList &selection, QObject *c dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), obj); const int idx = propertySheet->indexOf(m_propertyName); if (dynamicSheet->isDynamicProperty(idx)) - m_objectToValueAndChanged[obj] = qMakePair(propertySheet->property(idx), propertySheet->isChanged(idx)); + m_objectToValueAndChanged[obj] = {propertySheet->property(idx), + propertySheet->isChanged(idx)}; } setDescription(); diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h index aa8ca09b6..d069e76b1 100644 --- a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h +++ b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h @@ -49,7 +49,7 @@ class QDESIGNER_SHARED_EXPORT PropertyHelper { Q_DISABLE_COPY(PropertyHelper) public: // A pair of Value and changed flag - using Value = QPair<QVariant, bool>; + using Value = std::pair<QVariant, bool>; enum ObjectType {OT_Object, OT_FreeAction, OT_AssociatedAction, OT_Widget}; @@ -262,7 +262,7 @@ public: private: void setDescription(); QString m_propertyName; - QHash<QObject *, QPair<QVariant, bool> > m_objectToValueAndChanged; + QHash<QObject *, std::pair<QVariant, bool> > m_objectToValueAndChanged; }; } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h index 0a4344346..0aa1feb45 100644 --- a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h +++ b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h @@ -34,7 +34,7 @@ public: explicit QDesignerPropertyEditor(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); // A pair <ValidationMode, bool isTranslatable>. - using StringPropertyParameters = QPair<TextPropertyValidationMode, bool>; + using StringPropertyParameters = std::pair<TextPropertyValidationMode, bool>; // Return a pair of validation mode and flag indicating whether property is translatable // for textual properties. diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp index a85c09178..38bea7dbe 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -96,7 +96,7 @@ static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *obj // Cache DesignerMetaEnum by scope/name of a QMetaEnum static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDesignerMetaEnumInterface *me) { - using ScopeNameKey = QPair<QString, QString>; + using ScopeNameKey = std::pair<QString, QString>; static QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum> cache; const QString name = me->name(); @@ -117,7 +117,7 @@ static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDe // Cache DesignerMetaFlags by scope/name of a QMetaEnum static const qdesigner_internal::DesignerMetaFlags &designerMetaFlagsFor(const QDesignerMetaEnumInterface *me) { - using ScopeNameKey = QPair<QString, QString>; + using ScopeNameKey = std::pair<QString, QString>; static QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags> cache; const QString name = me->name(); diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp index c4af6a562..75d3d223b 100644 --- a/src/designer/src/lib/shared/qdesigner_utils.cpp +++ b/src/designer/src/lib/shared/qdesigner_utils.cpp @@ -372,13 +372,13 @@ namespace qdesigner_internal PropertySheetPixmapValue PropertySheetIconValue::pixmap(QIcon::Mode mode, QIcon::State state) const { - const ModeStateKey pair = qMakePair(mode, state); + const ModeStateKey pair{mode, state}; return m_data->m_paths.value(pair); } void PropertySheetIconValue::setPixmap(QIcon::Mode mode, QIcon::State state, const PropertySheetPixmapValue &pixmap) { - const ModeStateKey pair = qMakePair(mode, state); + const ModeStateKey pair{mode, state}; if (pixmap.path().isEmpty()) m_data->m_paths.remove(pair); else @@ -553,28 +553,28 @@ namespace qdesigner_internal return state == QIcon::On ? NormalOnIconMask : NormalOffIconMask; } - static inline QPair<QIcon::Mode, QIcon::State> subPropertyFlagToIconModeState(unsigned flag) + static inline std::pair<QIcon::Mode, QIcon::State> subPropertyFlagToIconModeState(unsigned flag) { switch (flag) { case NormalOnIconMask: - return qMakePair(QIcon::Normal, QIcon::On); + return {QIcon::Normal, QIcon::On}; case DisabledOffIconMask: - return qMakePair(QIcon::Disabled, QIcon::Off); + return {QIcon::Disabled, QIcon::Off}; case DisabledOnIconMask: - return qMakePair(QIcon::Disabled, QIcon::On); + return {QIcon::Disabled, QIcon::On}; case ActiveOffIconMask: - return qMakePair(QIcon::Active, QIcon::Off); + return {QIcon::Active, QIcon::Off}; case ActiveOnIconMask: - return qMakePair(QIcon::Active, QIcon::On); + return {QIcon::Active, QIcon::On}; case SelectedOffIconMask: - return qMakePair(QIcon::Selected, QIcon::Off); + return {QIcon::Selected, QIcon::Off}; case SelectedOnIconMask: - return qMakePair(QIcon::Selected, QIcon::On); + return {QIcon::Selected, QIcon::On}; case NormalOffIconMask: default: break; } - return qMakePair(QIcon::Normal, QIcon::Off); + return {QIcon::Normal, QIcon::Off}; } uint PropertySheetIconValue::mask() const @@ -593,7 +593,7 @@ namespace qdesigner_internal for (int i = 0; i < 8; i++) { const uint flag = 1 << i; if (diffMask & flag) { // if state is set in both icons, compare the values - const QPair<QIcon::Mode, QIcon::State> state = subPropertyFlagToIconModeState(flag); + const auto state = subPropertyFlagToIconModeState(flag); if (pixmap(state.first, state.second) == other.pixmap(state.first, state.second)) diffMask &= ~flag; } diff --git a/src/designer/src/lib/shared/qdesigner_utils_p.h b/src/designer/src/lib/shared/qdesigner_utils_p.h index 585a3f4f3..6a6625211 100644 --- a/src/designer/src/lib/shared/qdesigner_utils_p.h +++ b/src/designer/src/lib/shared/qdesigner_utils_p.h @@ -262,7 +262,7 @@ class QDESIGNER_SHARED_EXPORT PropertySheetIconValue PropertySheetIconValue themed() const; PropertySheetIconValue unthemed() const; - using ModeStateKey = QPair<QIcon::Mode, QIcon::State>; + using ModeStateKey = std::pair<QIcon::Mode, QIcon::State>; using ModeStateToPixmapMap = QMap<ModeStateKey, PropertySheetPixmapValue>; const ModeStateToPixmapMap &paths() const; diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp index b1e1375aa..f0ee5f51d 100644 --- a/src/designer/src/lib/shared/qlayout_widget.cpp +++ b/src/designer/src/lib/shared/qlayout_widget.cpp @@ -578,7 +578,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const Occupied // Item bordering on it }; // Horiontal, Vertical pair of state - using CellState = QPair<DimensionCellState, DimensionCellState>; + using CellState = std::pair<DimensionCellState, DimensionCellState>; using CellStates = QList<CellState>; // Figure out states of a cell and return as a flat vector of @@ -979,7 +979,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const // ---------------- FormLayoutHelper class FormLayoutHelper : public LayoutHelper { public: - using FormLayoutState = QList<QPair<QWidget *, QWidget *>>; + using FormLayoutState = QList<std::pair<QWidget *, QWidget *>>; FormLayoutHelper() = default; @@ -1143,7 +1143,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const void FormLayoutHelper::simplify(const QDesignerFormEditorInterface *core, QWidget *widgetWithManagedLayout, const QRect &restrictionArea) { - using LayoutItemPair = QPair<QLayoutItem*, QLayoutItem*>; + using LayoutItemPair = std::pair<QLayoutItem*, QLayoutItem*>; using LayoutItemPairs = QList<LayoutItemPair>; QFormLayout *formLayout = qobject_cast<QFormLayout *>(LayoutInfo::managedLayout(core, widgetWithManagedLayout)); @@ -1268,7 +1268,7 @@ void QLayoutSupport::setInsertMode(InsertMode im) m_currentInsertMode = im; } -void QLayoutSupport::setCurrentCell(const QPair<int, int> &cell) +void QLayoutSupport::setCurrentCell(const std::pair<int, int> &cell) { m_currentCell = cell; } @@ -1506,7 +1506,7 @@ class QBoxLayoutSupport: public QLayoutSupport public: QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, Qt::Orientation orientation, QObject *parent = nullptr); - void insertWidget(QWidget *widget, const QPair<int, int> &cell) override; + void insertWidget(QWidget *widget, const std::pair<int, int> &cell) override; void removeWidget(QWidget *widget) override; void simplify() override {} void insertRow(int /*row*/) override {} @@ -1532,7 +1532,7 @@ void QBoxLayoutSupport::removeWidget(QWidget *widget) // of higher index, which happens as follows: // Drag start: The widget is hidden // Drop: Current cell is stored, widget is removed and re-added, causing an index offset that needs to be compensated - QPair<int, int> currCell = currentCell(); + std::pair<int, int> currCell = currentCell(); switch (m_orientation) { case Qt::Horizontal: if (currCell.second > 0 && index < currCell.second ) { @@ -1559,10 +1559,10 @@ QBoxLayoutSupport::QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, Q void QBoxLayoutSupport::setCurrentCellFromIndicatorOnEmptyCell(int index) { qDebug() << "QBoxLayoutSupport::setCurrentCellFromIndicatorOnEmptyCell(): Warning: found a fake spacer inside a vbox layout at " << index; - setCurrentCell(qMakePair(0, 0)); + setCurrentCell({0, 0}); } -void QBoxLayoutSupport::insertWidget(QWidget *widget, const QPair<int, int> &cell) +void QBoxLayoutSupport::insertWidget(QWidget *widget, const std::pair<int, int> &cell) { switch (m_orientation) { case Qt::Horizontal: @@ -1576,11 +1576,10 @@ void QBoxLayoutSupport::insertWidget(QWidget *widget, const QPair<int, int> &cel void QBoxLayoutSupport::setCurrentCellFromIndicator(Qt::Orientation indicatorOrientation, int index, int increment) { - if (m_orientation == Qt::Horizontal && indicatorOrientation == Qt::Vertical) { - setCurrentCell(qMakePair(0, index + increment)); - } else if (m_orientation == Qt::Vertical && indicatorOrientation == Qt::Horizontal) { - setCurrentCell(qMakePair(index + increment, 0)); - } + if (m_orientation == Qt::Horizontal && indicatorOrientation == Qt::Vertical) + setCurrentCell({0, index + increment}); + else if (m_orientation == Qt::Vertical && indicatorOrientation == Qt::Horizontal) + setCurrentCell({index + increment, 0}); } bool QBoxLayoutSupport::supportsIndicatorOrientation(Qt::Orientation indicatorOrientation) const @@ -1638,7 +1637,7 @@ public: GridLikeLayoutSupportBase(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = nullptr) : QLayoutSupport(formWindow, widget, helper, parent) {} - void insertWidget(QWidget *widget, const QPair<int, int> &cell) override; + void insertWidget(QWidget *widget, const std::pair<int, int> &cell) override; void removeWidget(QWidget *widget) override { helper()->removeWidget(layout(), widget); } int findItemAt(int row, int column) const override; using QLayoutSupport::findItemAt; @@ -1670,7 +1669,7 @@ void GridLikeLayoutSupportBase<GridLikeLayout>::setCurrentCellFromIndicatorOnEmp int row, column, rowspan, colspan; getGridItemPosition(grid, index, &row, &column, &rowspan, &colspan); - setCurrentCell(qMakePair(row, column)); + setCurrentCell({row, column}); } template <class GridLikeLayout> @@ -1682,7 +1681,7 @@ void GridLikeLayoutSupportBase<GridLikeLayout>::setCurrentCellFromIndicator(Qt:: int row = info.top(); int column = increment ? info.right() + 1 : info.left(); checkCellForInsertion(&row, &column); - setCurrentCell(qMakePair(row , column)); + setCurrentCell({row, column}); } break; case Qt::Horizontal: { @@ -1690,14 +1689,14 @@ void GridLikeLayoutSupportBase<GridLikeLayout>::setCurrentCellFromIndicator(Qt:: int row = increment ? info.bottom() + 1 : info.top(); int column = info.left(); checkCellForInsertion(&row, &column); - setCurrentCell(qMakePair(row, column)); + setCurrentCell({row, column}); } break; } } template <class GridLikeLayout> -void GridLikeLayoutSupportBase<GridLikeLayout>::insertWidget(QWidget *widget, const QPair<int, int> &cell) +void GridLikeLayoutSupportBase<GridLikeLayout>::insertWidget(QWidget *widget, const std::pair<int, int> &cell) { helper()->insertWidget(layout(), QRect(cell.second, cell.first, 1, 1), widget); } diff --git a/src/designer/src/lib/shared/qlayout_widget_p.h b/src/designer/src/lib/shared/qlayout_widget_p.h index d07be3555..16185d5ec 100644 --- a/src/designer/src/lib/shared/qlayout_widget_p.h +++ b/src/designer/src/lib/shared/qlayout_widget_p.h @@ -157,7 +157,7 @@ public: InsertMode currentInsertMode() const override { return m_currentInsertMode; } - QPair<int, int> currentCell() const override { return m_currentCell; } + std::pair<int, int> currentCell() const override { return m_currentCell; } int findItemAt(const QPoint &pos) const override; int indexOf(QWidget *widget) const override; @@ -200,7 +200,7 @@ protected: QWidget *widget() const { return m_widget; } void setInsertMode(InsertMode im); - void setCurrentCell(const QPair<int, int> &cell); + void setCurrentCell(const std::pair<int, int> &cell); private: enum Indicator { LeftIndicator, TopIndicator, RightIndicator, BottomIndicator, NumIndicators }; @@ -215,7 +215,7 @@ private: QPointer<QWidget> m_indicators[NumIndicators]; int m_currentIndex; InsertMode m_currentInsertMode; - QPair<int, int> m_currentCell; + std::pair<int, int> m_currentCell; }; } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp index 3db2ff344..e9e3bbb54 100644 --- a/src/designer/src/lib/shared/qtresourceview.cpp +++ b/src/designer/src/lib/shared/qtresourceview.cpp @@ -356,15 +356,15 @@ void QtResourceViewPrivate::createPaths() } } - QQueue<QPair<QString, QTreeWidgetItem *> > pathToParentItemQueue; - pathToParentItemQueue.enqueue(qMakePair(root, static_cast<QTreeWidgetItem *>(nullptr))); + QQueue<std::pair<QString, QTreeWidgetItem *>> pathToParentItemQueue; + pathToParentItemQueue.enqueue(std::make_pair(root, static_cast<QTreeWidgetItem *>(nullptr))); while (!pathToParentItemQueue.isEmpty()) { - QPair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue(); + std::pair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue(); const QString path = pathToParentItem.first; QTreeWidgetItem *item = createPath(path, pathToParentItem.second); const QStringList subPaths = m_pathToSubPaths.value(path); for (const QString &subPath : subPaths) - pathToParentItemQueue.enqueue(qMakePair(subPath, item)); + pathToParentItemQueue.enqueue(std::make_pair(subPath, item)); } } diff --git a/src/designer/src/lib/shared/widgetdatabase_p.h b/src/designer/src/lib/shared/widgetdatabase_p.h index f8016035b..10c3af61e 100644 --- a/src/designer/src/lib/shared/widgetdatabase_p.h +++ b/src/designer/src/lib/shared/widgetdatabase_p.h @@ -115,7 +115,7 @@ private: enum IncludeType { IncludeLocal, IncludeGlobal }; -using IncludeSpecification = QPair<QString, IncludeType>; +using IncludeSpecification = std::pair<QString, IncludeType>; QDESIGNER_SHARED_EXPORT IncludeSpecification includeSpecification(QString includeFile); QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType); diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp index 0b55a4110..1f0e89253 100644 --- a/src/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp @@ -1689,12 +1689,12 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW auto items = ui_widget->elementItem(); - QQueue<QPair<QTreeWidgetItem *, DomItem *> > pendingQueue; + QQueue<std::pair<QTreeWidgetItem *, DomItem *> > pendingQueue; for (int i = 0; i < treeWidget->topLevelItemCount(); i++) - pendingQueue.enqueue(qMakePair(treeWidget->topLevelItem(i), nullptr)); + pendingQueue.enqueue(std::make_pair(treeWidget->topLevelItem(i), nullptr)); while (!pendingQueue.isEmpty()) { - const QPair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue(); + const std::pair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue(); QTreeWidgetItem *item = pair.first; DomItem *parentDomItem = pair.second; @@ -1725,7 +1725,7 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW items.append(currentDomItem); for (int i = 0; i < item->childCount(); i++) - pendingQueue.enqueue(qMakePair(item->child(i), currentDomItem)); + pendingQueue.enqueue(std::make_pair(item->child(i), currentDomItem)); } ui_widget->setElementItem(items); @@ -2040,13 +2040,13 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi } } - QQueue<QPair<DomItem *, QTreeWidgetItem *> > pendingQueue; + QQueue<std::pair<DomItem *, QTreeWidgetItem *> > pendingQueue; const auto &widgetElementItem = ui_widget->elementItem(); for (DomItem *ui_item : widgetElementItem) - pendingQueue.enqueue(qMakePair(ui_item, nullptr)); + pendingQueue.enqueue(std::make_pair(ui_item, nullptr)); while (!pendingQueue.isEmpty()) { - const QPair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue(); + const std::pair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue(); const DomItem *domItem = pair.first; QTreeWidgetItem *parentItem = pair.second; @@ -2085,9 +2085,9 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi if ((v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, property)).isValid()) currentItem->setData(col, role, v); } else { - QPair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair = + std::pair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair = strings.treeItemTextRoleHash.value(property->attributeName(), - qMakePair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1)); + std::make_pair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1)); if (rolePair.first >= 0) { QVariant textV = textBuilder()->loadText(property); QVariant nativeValue = textBuilder()->toNativeValue(textV); @@ -2101,7 +2101,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi const auto &elementItem = domItem->elementItem(); for (DomItem *childItem : elementItem) - pendingQueue.enqueue(qMakePair(childItem, currentItem)); + pendingQueue.enqueue(std::make_pair(childItem, currentItem)); } } diff --git a/src/designer/src/lib/uilib/abstractformbuilder.h b/src/designer/src/lib/uilib/abstractformbuilder.h index 3c5589193..e5073e6fc 100644 --- a/src/designer/src/lib/uilib/abstractformbuilder.h +++ b/src/designer/src/lib/uilib/abstractformbuilder.h @@ -198,7 +198,7 @@ protected: // Icon/pixmap stuff // // A Pair of icon path/qrc path. - using IconPaths = QPair<QString, QString>; + using IconPaths = std::pair<QString, QString>; void setIconProperty(DomProperty &, const IconPaths &) const; void setPixmapProperty(DomProperty &, const IconPaths &) const; diff --git a/src/designer/src/lib/uilib/formbuilderextra.cpp b/src/designer/src/lib/uilib/formbuilderextra.cpp index d9c9561d8..aae8ec0a0 100644 --- a/src/designer/src/lib/uilib/formbuilderextra.cpp +++ b/src/designer/src/lib/uilib/formbuilderextra.cpp @@ -474,7 +474,7 @@ void QFormBuilderExtra::clearGridLayoutColumnMinimumWidth(QGridLayout *grid) clearPerCellValue(grid, grid->columnCount(), &QGridLayout::setColumnMinimumWidth); } -void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip) +void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip) { DomResourcePixmap *pix = new DomResourcePixmap; if (!ip.second.isEmpty()) diff --git a/src/designer/src/lib/uilib/formbuilderextra_p.h b/src/designer/src/lib/uilib/formbuilderextra_p.h index 0cd92d3b4..f55945e81 100644 --- a/src/designer/src/lib/uilib/formbuilderextra_p.h +++ b/src/designer/src/lib/uilib/formbuilderextra_p.h @@ -107,7 +107,7 @@ public: // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group void registerButtonGroups(const DomButtonGroups *groups); - using ButtonGroupEntry = QPair<DomButtonGroup *, QButtonGroup*>; + using ButtonGroupEntry = std::pair<DomButtonGroup *, QButtonGroup *>; using ButtonGroupHash = QHash<QString, ButtonGroupEntry>; const ButtonGroupHash &buttonGroups() const { return m_buttonGroups; } ButtonGroupHash &buttonGroups() { return m_buttonGroups; } @@ -138,7 +138,7 @@ public: static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *); static void clearGridLayoutColumnMinimumWidth(QGridLayout *); - static void setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip); + static void setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip); static QPalette loadPalette(const DomPalette *dom); static void setupColorGroup(QPalette *palette, QPalette::ColorGroup colorGroup, const DomColorGroup *group); @@ -197,16 +197,16 @@ struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings { static constexpr auto iconAttribute = QLatin1StringView("icon"); static constexpr auto textAttribute = QLatin1StringView("text") ; - using RoleNName = QPair<Qt::ItemDataRole, QString>; + using RoleNName = std::pair<Qt::ItemDataRole, QString>; QList<RoleNName> itemRoles; QHash<QString, Qt::ItemDataRole> treeItemRoleHash; // first.first is primary role, first.second is shadow role. // Shadow is used for either the translation source or the designer // representation of the string value. - using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>; + using TextRoleNName = std::pair<std::pair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>; QList<TextRoleNName> itemTextRoles; - QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash; + QHash<QString, std::pair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash; }; #ifdef QFORMINTERNAL_NAMESPACE } diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index f03192300..e7aff7636 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -291,7 +291,7 @@ void MainWindow::save() outBuffer.write(reinterpret_cast<char *>(&fontDirectoryHeader), sizeof(FontDirectoryHeader)); - QVarLengthArray<QPair<quint32, quint32>> offsetLengthPairs; + QVarLengthArray<std::pair<quint32, quint32>> offsetLengthPairs; offsetLengthPairs.reserve(numTables - 1); // Copy the offset table, updating offsets @@ -302,7 +302,7 @@ void MainWindow::save() quint32 originalOffset = qFromBigEndian(offsetTable->offset); quint32 length = qFromBigEndian(offsetTable->length); - offsetLengthPairs.append(qMakePair(originalOffset, length)); + offsetLengthPairs.append({originalOffset, length}); if (offsetTable->tag == qFromBigEndian(QFont::Tag("head").value())) headOffset = currentOffset; @@ -346,7 +346,7 @@ void MainWindow::save() } // Copy all font tables - for (const QPair<quint32, quint32> &offsetLengthPair : offsetLengthPairs) { + for (const std::pair<quint32, quint32> &offsetLengthPair : offsetLengthPairs) { PAD_BUFFER(outBuffer, output.size()) outBuffer.write(reinterpret_cast<char *>(inData + offsetLengthPair.first), offsetLengthPair.second); diff --git a/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp b/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp index b3949590d..8dcd0171a 100644 --- a/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp +++ b/src/shared/qtgradienteditor/qtgradientstopscontroller.cpp @@ -173,7 +173,7 @@ QGradientStops QtGradientStopsControllerPrivate::makeGradientStops(const Positio { QGradientStops stops; for (auto itData = data.cbegin(), cend = data.cend(); itData != cend; ++itData) - stops << QPair<qreal, QColor>(itData.key(), itData.value()); + stops << std::pair<qreal, QColor>(itData.key(), itData.value()); return stops; } @@ -627,7 +627,7 @@ void QtGradientStopsController::setGradientStops(const QGradientStops &stops) { d_ptr->m_model->clear(); QtGradientStop *first = nullptr; - for (const QPair<qreal, QColor> &pair : stops) { + for (const std::pair<qreal, QColor> &pair : stops) { QtGradientStop *stop = d_ptr->m_model->addStop(pair.first, pair.second); if (!first) first = stop; @@ -641,7 +641,7 @@ QGradientStops QtGradientStopsController::gradientStops() const QGradientStops stops; const auto stopsList = d_ptr->m_model->stops().values(); for (const QtGradientStop *stop : stopsList) - stops << QPair<qreal, QColor>(stop->position(), stop->color()); + stops.append({stop->position(), stop->color()}); return stops; } diff --git a/src/shared/qtgradienteditor/qtgradientutils.cpp b/src/shared/qtgradienteditor/qtgradientutils.cpp index 625f1b159..fa79826b9 100644 --- a/src/shared/qtgradienteditor/qtgradientutils.cpp +++ b/src/shared/qtgradienteditor/qtgradientutils.cpp @@ -156,7 +156,7 @@ static QGradientStop loadGradientStop(const QDomElement &elem) return QGradientStop(); const qreal pos = static_cast<qreal>(elem.attribute("position"_L1).toDouble()); - return qMakePair(pos, loadColor(elem.firstChild().toElement())); + return std::make_pair(pos, loadColor(elem.firstChild().toElement())); } static QGradient loadGradient(const QDomElement &elem) diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.cpp b/src/shared/qtpropertybrowser/qtvariantproperty.cpp index 6e3452349..e3974a8dd 100644 --- a/src/shared/qtpropertybrowser/qtvariantproperty.cpp +++ b/src/shared/qtpropertybrowser/qtvariantproperty.cpp @@ -308,7 +308,7 @@ public: QMap<int, QtAbstractPropertyManager *> m_typeToPropertyManager; QMap<int, QMap<QString, int> > m_typeToAttributeToAttributeType; - QHash<const QtProperty *, QPair<QtVariantProperty *, int>> m_propertyToType; + QHash<const QtProperty *, std::pair<QtVariantProperty *, int>> m_propertyToType; QMap<int, int> m_typeToValueType; @@ -1868,7 +1868,7 @@ QtProperty *QtVariantPropertyManager::createProperty() return 0; auto *property = new QtVariantProperty(this); - d_ptr->m_propertyToType.insert(property, qMakePair(property, d_ptr->m_propertyType)); + d_ptr->m_propertyToType.insert(property, {property, d_ptr->m_propertyType}); return property; } |