diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-30 14:57:11 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-30 21:06:10 +0000 |
commit | ddd973ff04624791802fa09e0857f9b9c58baff3 (patch) | |
tree | 1303ab2898533c9d204072f9949e8a44459fb4b1 | |
parent | 43d67b302e601f72cc01b1585cc6031a5ce79906 (diff) |
Qt Designer: Fix clazy/Axivion warnings about QMap with pointer keys
Change-Id: Ia9a955893870ff1e83bba597932a65569ebfa450
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7086f38d74262b6b303cdae22ede5921ba6c2f48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
7 files changed, 89 insertions, 86 deletions
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.h b/src/designer/src/components/propertyeditor/brushpropertymanager.h index 6c469a7a5..478934a49 100644 --- a/src/designer/src/components/propertyeditor/brushpropertymanager.h +++ b/src/designer/src/components/propertyeditor/brushpropertymanager.h @@ -4,7 +4,7 @@ #ifndef BRUSHPROPERTYMANAGER_H #define BRUSHPROPERTYMANAGER_H -#include <QtCore/qmap.h> +#include <QtCore/qhash.h> #include <QtGui/qbrush.h> #include <QtGui/qicon.h> @@ -48,13 +48,13 @@ private: static const QMap<int, QIcon> &brushStyleIcons(); - using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>; + using PropertyToPropertyMap = QHash<QtProperty *, QtProperty *>; PropertyToPropertyMap m_brushPropertyToStyleSubProperty; PropertyToPropertyMap m_brushPropertyToColorSubProperty; PropertyToPropertyMap m_brushStyleSubPropertyToProperty; PropertyToPropertyMap m_brushColorSubPropertyToProperty; - QMap<QtProperty *, QBrush> m_brushValues; + QHash<QtProperty *, QBrush> m_brushValues; }; } diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp index a346db3bd..b4f9ccdc2 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -2552,8 +2552,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, template <class Editor> bool removeEditor(QObject *object, - QMap<QtProperty *, QList<Editor> > *propertyToEditors, - QMap<Editor, QtProperty *> *editorToProperty) + QHash<QtProperty *, QList<Editor>> *propertyToEditors, + QHash<Editor, QtProperty *> *editorToProperty) { if (!propertyToEditors) return false; @@ -2603,7 +2603,7 @@ void DesignerEditorFactory::slotEditorDestroyed(QObject *object) template<class Editor> bool updateManager(QtVariantEditorFactory *factory, bool *changingPropertyValue, - const QMap<Editor, QtProperty *> &editorToProperty, QWidget *editor, const QVariant &value) + const QHash<Editor, QtProperty *> &editorToProperty, QWidget *editor, const QVariant &value) { if (!editor) return false; @@ -2646,7 +2646,7 @@ void DesignerEditorFactory::slotByteArrayChanged(const QString &value) } template <class Editor> -QtProperty *findPropertyForEditor(const QMap<Editor *, QtProperty *> &editorMap, +QtProperty *findPropertyForEditor(const QHash<Editor *, QtProperty *> &editorMap, const QObject *sender) { for (auto it = editorMap.constBegin(), cend = editorMap.constEnd(); it != cend; ++it) diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.h b/src/designer/src/components/propertyeditor/designerpropertymanager.h index f0de463b7..34900cb21 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.h +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h @@ -12,7 +12,7 @@ #include <shared_enums_p.h> #include <QtCore/qurl.h> -#include <QtCore/qmap.h> +#include <QtCore/qhash.h> #include <QtGui/qfont.h> #include <QtGui/qicon.h> @@ -55,8 +55,8 @@ private slots: void slotPropertyChanged(QtProperty *property); void slotEditorDestroyed(QObject *object); private: - QMap<QtProperty *, QList<ResetWidget *> > m_createdResetWidgets; - QMap<ResetWidget *, QtProperty *> m_resetWidgetToProperty; + QHash<QtProperty *, QList<ResetWidget *>> m_createdResetWidgets; + QHash<ResetWidget *, QtProperty *> m_resetWidgetToProperty; int m_spacing; const QDesignerFormEditorInterface *m_core; }; @@ -152,7 +152,7 @@ private Q_SLOTS: private: void createIconSubProperty(QtProperty *iconProperty, QIcon::Mode mode, QIcon::State state, const QString &subName); - QMap<QtProperty *, bool> m_resetMap; + QHash<QtProperty *, bool> m_resetMap; struct FlagData { @@ -161,9 +161,9 @@ private: QList<uint> values; }; - QMap<QtProperty *, FlagData> m_flagValues; - QMap<QtProperty *, QList<QtProperty *>> m_propertyToFlags; - QMap<QtProperty *, QtProperty *> m_flagToProperty; + QHash<QtProperty *, FlagData> m_flagValues; + QHash<QtProperty *, QList<QtProperty *>> m_propertyToFlags; + QHash<QtProperty *, QtProperty *> m_flagToProperty; int alignToIndexH(uint align) const; int alignToIndexV(uint align) const; @@ -171,16 +171,16 @@ private: uint indexVToAlign(int idx) const; QString indexHToString(int idx) const; QString indexVToString(int idx) const; - QMap<QtProperty *, uint> m_alignValues; - using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>; + QHash<QtProperty *, uint> m_alignValues; + using PropertyToPropertyMap = QHash<QtProperty *, QtProperty *>; PropertyToPropertyMap m_propertyToAlignH; PropertyToPropertyMap m_propertyToAlignV; PropertyToPropertyMap m_alignHToProperty; PropertyToPropertyMap m_alignVToProperty; QHash<const QtProperty *, Qt::Alignment> m_alignDefault; - QMap<QtProperty *, QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> > m_propertyToIconSubProperties; - QMap<QtProperty *, QPair<QIcon::Mode, QIcon::State> > m_iconSubPropertyToState; + QHash<QtProperty *, QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *>> m_propertyToIconSubProperties; + QHash<QtProperty *, QPair<QIcon::Mode, QIcon::State>> m_iconSubPropertyToState; PropertyToPropertyMap m_iconSubPropertyToProperty; PropertyToPropertyMap m_propertyToTheme; @@ -193,26 +193,26 @@ private: QPalette val; QPalette superPalette; }; - QMap<QtProperty *, PaletteData> m_paletteValues; + QHash<QtProperty *, PaletteData> m_paletteValues; - QMap<QtProperty *, qdesigner_internal::PropertySheetPixmapValue> m_pixmapValues; - QMap<QtProperty *, qdesigner_internal::PropertySheetIconValue> m_iconValues; + QHash<QtProperty *, qdesigner_internal::PropertySheetPixmapValue> m_pixmapValues; + QHash<QtProperty *, qdesigner_internal::PropertySheetIconValue> m_iconValues; - QMap<QtProperty *, uint> m_uintValues; - QMap<QtProperty *, qlonglong> m_longLongValues; - QMap<QtProperty *, qulonglong> m_uLongLongValues; - QMap<QtProperty *, QUrl> m_urlValues; - QMap<QtProperty *, QByteArray> m_byteArrayValues; + QHash<QtProperty *, uint> m_uintValues; + QHash<QtProperty *, qlonglong> m_longLongValues; + QHash<QtProperty *, qulonglong> m_uLongLongValues; + QHash<QtProperty *, QUrl> m_urlValues; + QHash<QtProperty *, QByteArray> m_byteArrayValues; - QMap<QtProperty *, int> m_stringAttributes; - QMap<QtProperty *, QFont> m_stringFontAttributes; - QMap<QtProperty *, bool> m_stringThemeAttributes; + QHash<QtProperty *, int> m_stringAttributes; + QHash<QtProperty *, QFont> m_stringFontAttributes; + QHash<QtProperty *, bool> m_stringThemeAttributes; BrushPropertyManager m_brushManager; FontPropertyManager m_fontManager; - QMap<QtProperty *, QPixmap> m_defaultPixmaps; - QMap<QtProperty *, QIcon> m_defaultIcons; + QHash<QtProperty *, QPixmap> m_defaultPixmaps; + QHash<QtProperty *, QIcon> m_defaultIcons; bool m_changingSubValue; QDesignerFormEditorInterface *m_core; @@ -265,28 +265,28 @@ private: int m_spacing; - QMap<QtProperty *, QList<TextEditor *> > m_stringPropertyToEditors; - QMap<TextEditor *, QtProperty *> m_editorToStringProperty; - QMap<QtProperty *, QList<QKeySequenceEdit *> > m_keySequencePropertyToEditors; - QMap<QKeySequenceEdit *, QtProperty *> m_editorToKeySequenceProperty; - QMap<QtProperty *, QList<PaletteEditorButton *> > m_palettePropertyToEditors; - QMap<PaletteEditorButton *, QtProperty *> m_editorToPaletteProperty; - QMap<QtProperty *, QList<PixmapEditor *> > m_pixmapPropertyToEditors; - QMap<PixmapEditor *, QtProperty *> m_editorToPixmapProperty; - QMap<QtProperty *, QList<PixmapEditor *> > m_iconPropertyToEditors; - QMap<PixmapEditor *, QtProperty *> m_editorToIconProperty; - QMap<QtProperty *, QList<QLineEdit *> > m_uintPropertyToEditors; - QMap<QLineEdit *, QtProperty *> m_editorToUintProperty; - QMap<QtProperty *, QList<QLineEdit *> > m_longLongPropertyToEditors; - QMap<QLineEdit *, QtProperty *> m_editorToLongLongProperty; - QMap<QtProperty *, QList<QLineEdit *> > m_uLongLongPropertyToEditors; - QMap<QLineEdit *, QtProperty *> m_editorToULongLongProperty; - QMap<QtProperty *, QList<TextEditor *> > m_urlPropertyToEditors; - QMap<TextEditor *, QtProperty *> m_editorToUrlProperty; - QMap<QtProperty *, QList<TextEditor *> > m_byteArrayPropertyToEditors; - QMap<TextEditor *, QtProperty *> m_editorToByteArrayProperty; - QMap<QtProperty *, QList<StringListEditorButton *> > m_stringListPropertyToEditors; - QMap<StringListEditorButton *, QtProperty *> m_editorToStringListProperty; + QHash<QtProperty *, QList<TextEditor *>> m_stringPropertyToEditors; + QHash<TextEditor *, QtProperty *> m_editorToStringProperty; + QHash<QtProperty *, QList<QKeySequenceEdit *>> m_keySequencePropertyToEditors; + QHash<QKeySequenceEdit *, QtProperty *> m_editorToKeySequenceProperty; + QHash<QtProperty *, QList<PaletteEditorButton *>> m_palettePropertyToEditors; + QHash<PaletteEditorButton *, QtProperty *> m_editorToPaletteProperty; + QHash<QtProperty *, QList<PixmapEditor *>> m_pixmapPropertyToEditors; + QHash<PixmapEditor *, QtProperty *> m_editorToPixmapProperty; + QHash<QtProperty *, QList<PixmapEditor *>> m_iconPropertyToEditors; + QHash<PixmapEditor *, QtProperty *> m_editorToIconProperty; + QHash<QtProperty *, QList<QLineEdit *>> m_uintPropertyToEditors; + QHash<QLineEdit *, QtProperty *> m_editorToUintProperty; + QHash<QtProperty *, QList<QLineEdit *>> m_longLongPropertyToEditors; + QHash<QLineEdit *, QtProperty *> m_editorToLongLongProperty; + QHash<QtProperty *, QList<QLineEdit *>> m_uLongLongPropertyToEditors; + QHash<QLineEdit *, QtProperty *> m_editorToULongLongProperty; + QHash<QtProperty *, QList<TextEditor *>> m_urlPropertyToEditors; + QHash<TextEditor *, QtProperty *> m_editorToUrlProperty; + QHash<QtProperty *, QList<TextEditor *>> m_byteArrayPropertyToEditors; + QHash<TextEditor *, QtProperty *> m_editorToByteArrayProperty; + QHash<QtProperty *, QList<StringListEditorButton *>> m_stringListPropertyToEditors; + QHash<StringListEditorButton *, QtProperty *> m_editorToStringListProperty; }; } // namespace qdesigner_internal diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.h b/src/designer/src/components/propertyeditor/fontpropertymanager.h index 85c606c76..904a85a0b 100644 --- a/src/designer/src/components/propertyeditor/fontpropertymanager.h +++ b/src/designer/src/components/propertyeditor/fontpropertymanager.h @@ -4,6 +4,7 @@ #ifndef FONTPROPERTYMANAGER_H #define FONTPROPERTYMANAGER_H +#include <QtCore/qhash.h> #include <QtCore/qmap.h> #include <QtCore/qstringlist.h> #include <QtGui/qfont.h> @@ -30,7 +31,7 @@ class FontPropertyManager { public: FontPropertyManager(); - using ResetMap = QMap<QtProperty *, bool>; + using ResetMap = QHash<QtProperty *, bool>; using NameMap = QMap<QString, QString>; // Call before QtVariantPropertyManager::initializeProperty. @@ -55,7 +56,7 @@ public: static bool readFamilyMapping(NameMap *rc, QString *errorMessage); private: - using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>; + using PropertyToPropertyMap = QHash<QtProperty *, QtProperty *>; using PropertyList = QList<QtProperty *>; void removeAntialiasingProperty(QtProperty *); @@ -79,8 +80,8 @@ private: PropertyToPropertyMap m_hintingPreferenceToProperty; - QMap<QtProperty *, PropertyList> m_propertyToFontSubProperties; - QMap<QtProperty *, int> m_fontSubPropertyToFlag; + QHash<QtProperty *, PropertyList> m_propertyToFontSubProperties; + QHash<QtProperty *, int> m_fontSubPropertyToFlag; PropertyToPropertyMap m_fontSubPropertyToProperty; QtProperty *m_createdFontProperty = nullptr; QStringList m_aliasingEnumNames; diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp index 3a9c7cac3..c5a27b831 100644 --- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp +++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp @@ -321,9 +321,9 @@ private: QList<QtQrcFile *> m_qrcFiles; QMap<QString, QtQrcFile *> m_pathToQrc; - QMap<QtQrcFile *, bool> m_qrcFileToExists; - QMap<QtResourcePrefix *, QtQrcFile *> m_prefixToQrc; - QMap<QtResourceFile *, QtResourcePrefix *> m_fileToPrefix; + QHash<QtQrcFile *, bool> m_qrcFileToExists; + QHash<QtResourcePrefix *, QtQrcFile *> m_prefixToQrc; + QHash<QtResourceFile *, QtResourcePrefix *> m_fileToPrefix; QMap<QString, QList<QtResourceFile *> > m_fullPathToResourceFiles; QMap<QString, QIcon> m_fullPathToIcon; QMap<QString, bool> m_fullPathToExists; @@ -849,16 +849,16 @@ public: QtQrcManager *m_qrcManager = nullptr; QList<QtQrcFileData> m_initialState; - QMap<QtQrcFile *, QListWidgetItem *> m_qrcFileToItem; - QMap<QListWidgetItem *, QtQrcFile *> m_itemToQrcFile; - QMap<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToPrefixItem; - QMap<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToLanguageItem; - QMap<QStandardItem *, QtResourcePrefix *> m_prefixItemToResourcePrefix; - QMap<QStandardItem *, QtResourcePrefix *> m_languageItemToResourcePrefix; - QMap<QtResourceFile *, QStandardItem *> m_resourceFileToPathItem; - QMap<QtResourceFile *, QStandardItem *> m_resourceFileToAliasItem; - QMap<QStandardItem *, QtResourceFile *> m_pathItemToResourceFile; - QMap<QStandardItem *, QtResourceFile *> m_aliasItemToResourceFile; + QHash<QtQrcFile *, QListWidgetItem *> m_qrcFileToItem; + QHash<QListWidgetItem *, QtQrcFile *> m_itemToQrcFile; + QHash<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToPrefixItem; + QHash<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToLanguageItem; + QHash<QStandardItem *, QtResourcePrefix *> m_prefixItemToResourcePrefix; + QHash<QStandardItem *, QtResourcePrefix *> m_languageItemToResourcePrefix; + QHash<QtResourceFile *, QStandardItem *> m_resourceFileToPathItem; + QHash<QtResourceFile *, QStandardItem *> m_resourceFileToAliasItem; + QHash<QStandardItem *, QtResourceFile *> m_pathItemToResourceFile; + QHash<QStandardItem *, QtResourceFile *> m_aliasItemToResourceFile; bool m_ignoreCurrentChanged = false; bool m_firstQrcFileDialog = true; @@ -1176,7 +1176,7 @@ void QtResourceEditorDialogPrivate::slotCurrentQrcFileChanged(QListWidgetItem *i return; if (m_currentQrcFile) { - QMap<QtResourcePrefix *, QStandardItem *> currentPrefixList = m_resourcePrefixToPrefixItem; + QHash<QtResourcePrefix *, QStandardItem *> currentPrefixList = m_resourcePrefixToPrefixItem; for (auto it = currentPrefixList.cbegin(), end = currentPrefixList.cend(); it != end; ++it) { QtResourcePrefix *resourcePrefix = it.key(); const auto currentResourceFiles = resourcePrefix->resourceFiles(); diff --git a/src/designer/src/lib/shared/qtresourcemodel.cpp b/src/designer/src/lib/shared/qtresourcemodel.cpp index 4630bcd56..056c09c55 100644 --- a/src/designer/src/lib/shared/qtresourcemodel.cpp +++ b/src/designer/src/lib/shared/qtresourcemodel.cpp @@ -5,6 +5,7 @@ #include "rcc_p.h" #include <QtCore/qstringlist.h> +#include <QtCore/qhash.h> #include <QtCore/qmap.h> #include <QtCore/qresource.h> #include <QtCore/qfileinfo.h> @@ -46,16 +47,16 @@ public: void activate(QtResourceSet *resourceSet, const QStringList &newPaths, int *errorCount = nullptr, QString *errorMessages = nullptr); void removeOldPaths(QtResourceSet *resourceSet, const QStringList &newPaths); - QMap<QString, bool> m_pathToModified; - QMap<QtResourceSet *, QStringList> m_resourceSetToPaths; - QMap<QtResourceSet *, bool> m_resourceSetToReload; // while path is recreated it needs to be reregistered - // (it is - in the new current resource set, but when the path was used in - // other resource set - // then later when that resource set is activated it needs to be reregistered) - QMap<QtResourceSet *, bool> m_newlyCreated; // all created but not activated yet - // (if was active at some point and it's not now it will not be on that map) - QMap<QString, QList<QtResourceSet *> > m_pathToResourceSet; - QtResourceSet *m_currentResourceSet = nullptr; + QMap<QString, bool> m_pathToModified; + QHash<QtResourceSet *, QStringList> m_resourceSetToPaths; + QHash<QtResourceSet *, bool> m_resourceSetToReload; // while path is recreated it needs to be reregistered + // (it is - in the new current resource set, but when the path was used in + // other resource set + // then later when that resource set is activated it needs to be reregistered) + QHash<QtResourceSet *, bool> m_newlyCreated; // all created but not activated yet + // (if was active at some point and it's not now it will not be on that map) + QMap<QString, QList<QtResourceSet *>> m_pathToResourceSet; + QtResourceSet *m_currentResourceSet = nullptr; QMap<QString, const QByteArray *> m_pathToData; diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp index ef4d8a509..ab586c2a5 100644 --- a/src/designer/src/lib/shared/qtresourceview.cpp +++ b/src/designer/src/lib/shared/qtresourceview.cpp @@ -32,6 +32,7 @@ #include <QtCore/qmimedata.h> #include <QtCore/qfileinfo.h> #include <QtCore/qdir.h> +#include <QtCore/qhash.h> #include <QtCore/qqueue.h> #include <QtXml/qdom.h> @@ -137,13 +138,13 @@ public: QTreeWidget *m_treeWidget; QListWidget *m_listWidget; QSplitter *m_splitter = nullptr; - QMap<QString, QStringList> m_pathToContents; // full path to contents file names (full path to its resource filenames) - QMap<QString, QString> m_pathToParentPath; // full path to full parent path - QMap<QString, QStringList> m_pathToSubPaths; // full path to full sub paths + QMap<QString, QStringList> m_pathToContents; // full path to contents file names (full path to its resource filenames) + QMap<QString, QString> m_pathToParentPath; // full path to full parent path + QMap<QString, QStringList> m_pathToSubPaths; // full path to full sub paths QMap<QString, QTreeWidgetItem *> m_pathToItem; - QMap<QTreeWidgetItem *, QString> m_itemToPath; + QHash<QTreeWidgetItem *, QString> m_itemToPath; QMap<QString, QListWidgetItem *> m_resourceToItem; - QMap<QListWidgetItem *, QString> m_itemToResource; + QHash<QListWidgetItem *, QString> m_itemToResource; QAction *m_editResourcesAction = nullptr; QAction *m_reloadResourcesAction = nullptr; QAction *m_copyResourcePathAction = nullptr; |