diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-30 14:49:58 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-30 22:54:31 +0200 |
commit | bf0e106f00a590c9b5030b940da2603b2cffe214 (patch) | |
tree | 9d6e41f93dd1a71eb4516a575dc0ca80553919b8 | |
parent | 63ad31821b466d3140d4bfcbc38d8db00adeac16 (diff) |
Qt Designer: Migrate typedef->using
Pick-to: 6.5
Change-Id: I832deaab6fc64d732051707358870d0c2deffcd8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
23 files changed, 30 insertions, 46 deletions
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp index 0e2c0f52a..35cb0eca6 100644 --- a/src/designer/src/components/formeditor/formwindow.cpp +++ b/src/designer/src/components/formeditor/formwindow.cpp @@ -145,8 +145,7 @@ private: using SelectionPool = QList<WidgetSelection *>; SelectionPool m_selectionPool; - typedef QHash<QWidget *, WidgetSelection *> SelectionHash; - SelectionHash m_usedSelections; + QHash<QWidget *, WidgetSelection *> m_usedSelections; }; FormWindow::Selection::Selection() = default; diff --git a/src/designer/src/components/formeditor/layout_propertysheet.h b/src/designer/src/components/formeditor/layout_propertysheet.h index aca6dafa0..5d59071de 100644 --- a/src/designer/src/components/formeditor/layout_propertysheet.h +++ b/src/designer/src/components/formeditor/layout_propertysheet.h @@ -36,7 +36,7 @@ private: QLayout *m_layout; }; -typedef QDesignerPropertySheetFactory<QLayout, LayoutPropertySheet> LayoutPropertySheetFactory; +using LayoutPropertySheetFactory = QDesignerPropertySheetFactory<QLayout, LayoutPropertySheet>; } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp index b6e61606d..213645e39 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp @@ -1818,8 +1818,7 @@ DomCustomWidgets *QDesignerResource::saveCustomWidgets() QDesignerFormEditorInterface *core = m_formWindow->core(); QDesignerWidgetDataBaseInterface *db = core->widgetDataBase(); const bool isInternalWidgetDataBase = qobject_cast<const WidgetDataBase *>(db); - typedef QMap<int,DomCustomWidget*> OrderedDBIndexDomCustomWidgetMap; - OrderedDBIndexDomCustomWidgetMap orderedMap; + QMap<int, DomCustomWidget *> orderedMap; for (auto it = m_usedCustomWidgets.cbegin(), end = m_usedCustomWidgets.cend(); it != end; ++it) { QDesignerWidgetDataBaseItemInterface *item = it.key(); diff --git a/src/designer/src/components/objectinspector/objectinspectormodel_p.h b/src/designer/src/components/objectinspector/objectinspectormodel_p.h index 20cd7ecee..4a377fc21 100644 --- a/src/designer/src/components/objectinspector/objectinspectormodel_p.h +++ b/src/designer/src/components/objectinspector/objectinspectormodel_p.h @@ -110,15 +110,13 @@ namespace qdesigner_internal { bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; private: - typedef QMultiMap<QObject *,QModelIndex> ObjectIndexMultiMap; - void rebuild(const ObjectModel &newModel); void updateItemContents(ObjectModel &oldModel, const ObjectModel &newModel); void clearItems(); StandardItemList rowAt(QModelIndex index) const; ObjectInspectorIcons m_icons; - ObjectIndexMultiMap m_objectIndexMultiMap; + QMultiMap<QObject *, QModelIndex> m_objectIndexMultiMap; ObjectModel m_model; QPointer<QDesignerFormWindowInterface> m_formWindow; }; diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp index 38b4b6a9d..e0e12e8ec 100644 --- a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp @@ -101,7 +101,7 @@ static void clearBrushIcons() brushIcons()->clear(); } -const BrushPropertyManager::EnumIndexIconMap &BrushPropertyManager::brushStyleIcons() +const QMap<int, QIcon> &BrushPropertyManager::brushStyleIcons() { // Create a map of icons for the brush style editor if (brushIcons()->empty()) { diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.h b/src/designer/src/components/propertyeditor/brushpropertymanager.h index b8aa895cf..6c469a7a5 100644 --- a/src/designer/src/components/propertyeditor/brushpropertymanager.h +++ b/src/designer/src/components/propertyeditor/brushpropertymanager.h @@ -46,10 +46,9 @@ private: static Qt::BrushStyle brushStyleIndexToStyle(int brushStyleIndex); static QString brushStyleIndexToString(int brushStyleIndex); - typedef QMap<int, QIcon> EnumIndexIconMap; - static const EnumIndexIconMap &brushStyleIcons(); + static const QMap<int, QIcon> &brushStyleIcons(); - typedef QMap<QtProperty *, QtProperty *> PropertyToPropertyMap; + using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>; PropertyToPropertyMap m_brushPropertyToStyleSubProperty; PropertyToPropertyMap m_brushPropertyToColorSubProperty; PropertyToPropertyMap m_brushStyleSubPropertyToProperty; diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.h b/src/designer/src/components/propertyeditor/designerpropertymanager.h index e99267de8..f0de463b7 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.h +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h @@ -18,7 +18,7 @@ QT_BEGIN_NAMESPACE -typedef QPair<QString, uint> DesignerIntPair; +using DesignerIntPair = QPair<QString, uint>; using DesignerFlagList = QList<DesignerIntPair>; class QDesignerFormEditorInterface; @@ -152,8 +152,7 @@ private Q_SLOTS: private: void createIconSubProperty(QtProperty *iconProperty, QIcon::Mode mode, QIcon::State state, const QString &subName); - typedef QMap<QtProperty *, bool> PropertyBoolMap; - PropertyBoolMap m_resetMap; + QMap<QtProperty *, bool> m_resetMap; struct FlagData { @@ -173,7 +172,7 @@ private: QString indexHToString(int idx) const; QString indexVToString(int idx) const; QMap<QtProperty *, uint> m_alignValues; - typedef QMap<QtProperty *, QtProperty *> PropertyToPropertyMap; + using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>; PropertyToPropertyMap m_propertyToAlignH; PropertyToPropertyMap m_propertyToAlignV; PropertyToPropertyMap m_alignHToProperty; @@ -207,7 +206,7 @@ private: QMap<QtProperty *, int> m_stringAttributes; QMap<QtProperty *, QFont> m_stringFontAttributes; - PropertyBoolMap m_stringThemeAttributes; + QMap<QtProperty *, bool> m_stringThemeAttributes; BrushPropertyManager m_brushManager; FontPropertyManager m_fontManager; diff --git a/src/designer/src/components/taskmenu/groupbox_taskmenu.h b/src/designer/src/components/taskmenu/groupbox_taskmenu.h index 19e933632..6217273c7 100644 --- a/src/designer/src/components/taskmenu/groupbox_taskmenu.h +++ b/src/designer/src/components/taskmenu/groupbox_taskmenu.h @@ -31,7 +31,7 @@ private: QList<QAction*> m_taskActions; }; -typedef ExtensionFactory<QDesignerTaskMenuExtension, QGroupBox, GroupBoxTaskMenu> GroupBoxTaskMenuFactory; +using GroupBoxTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QGroupBox, GroupBoxTaskMenu>; } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.h b/src/designer/src/components/taskmenu/treewidget_taskmenu.h index fc1921808..5ad6c34c8 100644 --- a/src/designer/src/components/taskmenu/treewidget_taskmenu.h +++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.h @@ -39,7 +39,7 @@ private: QAction *m_editItemsAction; }; -typedef ExtensionFactory<QDesignerTaskMenuExtension, QTreeWidget, TreeWidgetTaskMenu> TreeWidgetTaskMenuFactory; +using TreeWidgetTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QTreeWidget, TreeWidgetTaskMenu>; } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp index 06798e3df..2f484fa58 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 IdObjectKey key = qMakePair(iid, object); + const auto key = qMakePair(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 8ff1dd9e1..eb9e3dc62 100644 --- a/src/designer/src/lib/extension/default_extensionfactory.h +++ b/src/designer/src/lib/extension/default_extensionfactory.h @@ -33,8 +33,7 @@ protected: virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; private: - typedef QPair<QString,QObject*> IdObjectKey; - mutable QMap< IdObjectKey, QObject *> m_extensions; + mutable QMap<QPair<QString, QObject *>, QObject *> m_extensions; mutable QSet<QObject *> m_extended; }; diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp index 4058e78b7..775821269 100644 --- a/src/designer/src/lib/shared/formlayoutmenu.cpp +++ b/src/designer/src/lib/shared/formlayoutmenu.cpp @@ -330,9 +330,6 @@ void FormLayoutRowDialog::buddyClicked() * from them ("QLineEdit", "CustomLineEdit", "QComboBox"...). */ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface *core) { - // Base class -> custom widgets map - typedef QMultiHash<QString, QString> ClassMap; - static QStringList rc; if (rc.isEmpty()) { // Turn known base classes into list @@ -342,7 +339,7 @@ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface // Scan for custom widgets that inherit them and store them in a // multimap of base class->custom widgets unless we have a language // extension installed which might do funny things with custom widgets. - ClassMap customClassMap; + QMultiHash<QString, QString> customClassMap; // Base class -> custom widgets map if (qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core) == nullptr) { const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase(); const int wdbCount = wdb->count(); diff --git a/src/designer/src/lib/shared/layout_p.h b/src/designer/src/lib/shared/layout_p.h index 9e0c7fa7e..2dd8ee7e6 100644 --- a/src/designer/src/lib/shared/layout_p.h +++ b/src/designer/src/lib/shared/layout_p.h @@ -77,8 +77,7 @@ private slots: private: QWidgetList m_widgets; QWidget *m_parentWidget; - typedef QHash<QWidget *, QRect> WidgetGeometryHash; - WidgetGeometryHash m_geometries; + QHash<QWidget *, QRect> m_geometries; QWidget *m_layoutBase; QDesignerFormWindowInterface *m_formWindow; const LayoutInfo::Type m_layoutType; diff --git a/src/designer/src/lib/shared/pluginmanager_p.h b/src/designer/src/lib/shared/pluginmanager_p.h index d59c77963..87e95d2ac 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. - typedef QPair<qdesigner_internal::TextPropertyValidationMode, bool> StringPropertyType; + using StringPropertyType = QPair<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 d32e0294b..4d466af71 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 -typedef QPair<QString, QString> SkinNamePath; +using SkinNamePath = QPair<QString, QString>; using Skins = QList<SkinNamePath>; enum { SkinComboNoneIndex = 0 }; diff --git a/src/designer/src/lib/shared/qdesigner_dnditem.cpp b/src/designer/src/lib/shared/qdesigner_dnditem.cpp index 7dc853114..d7875f55c 100644 --- a/src/designer/src/lib/shared/qdesigner_dnditem.cpp +++ b/src/designer/src/lib/shared/qdesigner_dnditem.cpp @@ -216,8 +216,7 @@ void QDesignerMimeData::moveDecoration(const QPoint &globalPos) const void QDesignerMimeData::removeMovedWidgetsFromSourceForm(const QDesignerDnDItems &items) { - typedef QMultiMap<FormWindowBase *, QWidget *> FormWidgetMap; - FormWidgetMap formWidgetMap; + QMultiMap<FormWindowBase *, QWidget *> formWidgetMap; // Find moved widgets per form for (auto *item : items) { if (item->type() == QDesignerDnDItemInterface::MoveDrop) { diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp index b949ff9b0..d64217757 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -496,8 +496,7 @@ QDesignerPropertySheet::ObjectFlags QDesignerPropertySheet::objectFlagsFromObjec QDesignerPropertySheet::PropertyType QDesignerPropertySheet::propertyTypeFromName(const QString &name) { - typedef QHash<QString, PropertyType> PropertyTypeHash; - static const PropertyTypeHash propertyTypeHash= { + static const QHash<QString, PropertyType> propertyTypeHash = { {QLatin1StringView(layoutObjectNameC), PropertyLayoutObjectName}, {QLatin1StringView(layoutLeftMarginC), PropertyLayoutLeftMargin}, {QLatin1StringView(layoutTopMarginC), PropertyLayoutTopMargin}, diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h index 6cfc4efed..b9f88626f 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h +++ b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h @@ -231,7 +231,7 @@ void QDesignerPropertySheetFactory<Object, PropertySheet>::registerExtension(QEx // Standard property sheet -typedef QDesignerPropertySheetFactory<QObject, QDesignerPropertySheet> QDesignerDefaultPropertySheetFactory; +using QDesignerDefaultPropertySheetFactory = QDesignerPropertySheetFactory<QObject, QDesignerPropertySheet>; Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerPropertySheet::ObjectFlags) diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp index 97775328c..465434737 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 - typedef QPair<DimensionCellState, DimensionCellState> CellState; + using CellState = QPair<DimensionCellState, DimensionCellState>; using CellStates = QList<CellState>; // Figure out states of a cell and return as a flat vector of @@ -979,8 +979,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const // ---------------- FormLayoutHelper class FormLayoutHelper : public LayoutHelper { public: - typedef QPair<QWidget *, QWidget *> WidgetPair; - using FormLayoutState = QList<WidgetPair>; + using FormLayoutState = QList<QPair<QWidget *, QWidget *>>; FormLayoutHelper() = default; @@ -1073,7 +1072,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const const int rowCount = lt->rowCount(); if (rowCount == 0) return FormLayoutState(); - FormLayoutState rc(rowCount, WidgetPair(0, 0)); + FormLayoutState rc(rowCount, {nullptr, nullptr}); const int count = lt->count(); int row, column, colspan; for (int i = 0; i < count; i++) { diff --git a/src/designer/src/lib/shared/rcc_p.h b/src/designer/src/lib/shared/rcc_p.h index 74af14fe9..90a1d3b5c 100644 --- a/src/designer/src/lib/shared/rcc_p.h +++ b/src/designer/src/lib/shared/rcc_p.h @@ -49,7 +49,7 @@ public: QStringList dataFiles() const; // Return a map of resource identifier (':/newPrefix/images/p1.png') to file. - typedef QHash<QString, QString> ResourceDataFileMap; + using ResourceDataFileMap = QHash<QString, QString>; ResourceDataFileMap resourceDataFileMap() const; void setVerbose(bool b) { m_verbose = b; } diff --git a/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp b/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp index 6384822ab..61a5321ca 100644 --- a/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp +++ b/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp @@ -40,8 +40,7 @@ bool QAxWidgetExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) /* Turn off standard setters and make sure "control" is in front, * otherwise, previews will not work as the properties are not applied via * the caching property sheet, them. */ - typedef QList<DomProperty *> DomPropertyList; - DomPropertyList props = ui_widget->elementProperty(); + QList<DomProperty *> props = ui_widget->elementProperty(); const qsizetype size = props.size(); const QString controlProperty = QLatin1String(QAxWidgetPropertySheet::controlPropertyName); for (qsizetype i = 0; i < size; ++i) { diff --git a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h index 5c642f87f..34126a190 100644 --- a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h +++ b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h @@ -47,8 +47,7 @@ private: const QString m_propertyGroup; int m_controlIndex; struct SavedProperties { - typedef QMap<QString, QVariant> NamePropertyMap; - NamePropertyMap changedProperties; + QVariantMap changedProperties; QWidget *widget; QString clsid; } m_currentProperties; @@ -56,7 +55,7 @@ private: static void reloadPropertySheet(const struct SavedProperties &properties, QDesignerFormWindowInterface *formWin); }; -typedef QDesignerPropertySheetFactory<QDesignerAxWidget, QAxWidgetPropertySheet> ActiveXPropertySheetFactory; +using ActiveXPropertySheetFactory = QDesignerPropertySheetFactory<QDesignerAxWidget, QAxWidgetPropertySheet>; QT_END_NAMESPACE diff --git a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h index c44009b86..715eefa9f 100644 --- a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h +++ b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h @@ -31,7 +31,7 @@ private: QList<QAction*> m_taskActions; }; -typedef qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, QDesignerAxWidget, QAxWidgetTaskMenu> ActiveXTaskMenuFactory; +using ActiveXTaskMenuFactory = qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, QDesignerAxWidget, QAxWidgetTaskMenu>; QT_END_NAMESPACE |