diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-31 09:21:53 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-31 10:54:18 +0000 |
commit | e19fa789c3f4ebed589b3f8c267414a41a69bfc6 (patch) | |
tree | 4999aa894845bc7fafbc1f5908a7be58f74b0740 | |
parent | ac160d140d4fee7e9f6d3b6e9e3ae5a1232545ad (diff) |
Qt Designer/Shared solutions: Fix clazy/Axivion warnings about QMap with pointer keys
Change-Id: Id7b644912daac479989b5928f8157a2a874776f1
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit fd6e577676afb10bc24768db76f6d6449a5ee828)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
4 files changed, 37 insertions, 33 deletions
diff --git a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp index 32924a067..cea8feb6b 100644 --- a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp +++ b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp @@ -2,7 +2,9 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qtgradientstopsmodel.h" + #include <QtGui/QColor> +#include <QtCore/QHash> QT_BEGIN_NAMESPACE @@ -57,8 +59,8 @@ class QtGradientStopsModelPrivate Q_DECLARE_PUBLIC(QtGradientStopsModel) public: QMap<qreal, QtGradientStop *> m_posToStop; - QMap<QtGradientStop *, qreal> m_stopToPos; - QMap<QtGradientStop *, bool> m_selection; + QHash<QtGradientStop *, qreal> m_stopToPos; + QHash<QtGradientStop *, bool> m_selection; QtGradientStop *m_current; }; @@ -385,7 +387,7 @@ void QtGradientStopsModel::clearSelection() void QtGradientStopsModel::flipAll() { QMap<qreal, QtGradientStop *> stopsMap = stops(); - QMap<QtGradientStop *, bool> swappedList; + QHash<QtGradientStop *, bool> swappedList; for (auto itStop = stopsMap.keyValueEnd(), begin = stopsMap.keyValueBegin(); itStop != begin;) { --itStop; QtGradientStop *stop = (*itStop).second; diff --git a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp index b0d1accb5..c0aff22eb 100644 --- a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp +++ b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp @@ -5,6 +5,7 @@ #include "qtgradientstopsmodel.h" #include <QtCore/QMap> +#include <QtCore/QHash> #include <QtCore/QMimeData> #include <QtGui/QImage> #include <QtGui/QPainter> @@ -73,7 +74,7 @@ public: bool m_moving; int m_moveOffset; - QMap<QtGradientStop *, qreal> m_moveStops; + QHash<QtGradientStop *, qreal> m_moveStops; QMap<qreal, QColor> m_moveOriginal; }; diff --git a/src/shared/qtgradienteditor/qtgradientview.h b/src/shared/qtgradienteditor/qtgradientview.h index f8f291941..53a44cf24 100644 --- a/src/shared/qtgradienteditor/qtgradientview.h +++ b/src/shared/qtgradienteditor/qtgradientview.h @@ -5,7 +5,7 @@ #define GRADIENTVIEW_H #include <QtWidgets/QWidget> -#include <QtCore/QMap> +#include <QtCore/QHash> #include "ui_qtgradientview.h" QT_BEGIN_NAMESPACE @@ -44,8 +44,8 @@ private slots: void slotGradientActivated(QListWidgetItem *item); private: - QMap<QString, QListWidgetItem *> m_idToItem; - QMap<QListWidgetItem *, QString> m_itemToId; + QHash<QString, QListWidgetItem *> m_idToItem; + QHash<QListWidgetItem *, QString> m_itemToId; QAction *m_newAction; QAction *m_editAction; diff --git a/src/shared/qttoolbardialog/qttoolbardialog.cpp b/src/shared/qttoolbardialog/qttoolbardialog.cpp index e11f4ae93..ab215e181 100644 --- a/src/shared/qttoolbardialog/qttoolbardialog.cpp +++ b/src/shared/qttoolbardialog/qttoolbardialog.cpp @@ -5,6 +5,7 @@ #include "ui_qttoolbardialog.h" #include <QtCore/QMap> +#include <QtCore/QHash> #include <QtCore/QSet> #include <QtGui/QAction> #include <QtGui/QtEvents> @@ -50,7 +51,7 @@ public: void removeDefaultToolBar(QToolBar *toolBar); // NULL on action list means separator. - QMap<QToolBar *, QList<QAction *> > defaultToolBars() const; + QHash<QToolBar *, QList<QAction *>> defaultToolBars() const; bool isDefaultToolBar(QToolBar *toolBar) const; QToolBar *createToolBar(const QString &toolBarName); @@ -58,10 +59,10 @@ public: QList<QAction *> actions(QToolBar *toolBar) const; - void setToolBars(const QMap<QToolBar *, QList<QAction *> > &actions); + void setToolBars(const QHash<QToolBar *, QList<QAction *>> &actions); void setToolBar(QToolBar *toolBar, const QList<QAction *> &actions); - QMap<QToolBar *, QList<QAction *> > toolBarsActions() const; + QHash<QToolBar *, QList<QAction *>> toolBarsActions() const; QByteArray saveState(int version = 0) const; bool restoreState(const QByteArray &state, int version = 0); @@ -96,7 +97,7 @@ class QtFullToolBarManagerPrivate public: QToolBar *toolBarWidgetAction(QAction *action) const; - void removeWidgetActions(const QMap<QToolBar *, QList<QAction *> > &actions); + void removeWidgetActions(const QHash<QToolBar *, QList<QAction *>> &actions); enum { VersionMarker = 0xff, @@ -111,17 +112,17 @@ public: QToolBar *toolBarByName(const QString &toolBarName) const; - QMap<QString, QList<QAction *> > categoryToActions; - QMap<QAction *, QString> actionToCategory; + QHash<QString, QList<QAction *>> categoryToActions; + QHash<QAction *, QString> actionToCategory; QSet<QAction *> allActions; - QMap<QAction *, QToolBar *> widgetActions; + QHash<QAction *, QToolBar *> widgetActions; QSet<QAction *> regularActions; - QMap<QAction *, QList<QToolBar *> > actionToToolBars; + QHash<QAction *, QList<QToolBar *>> actionToToolBars; - QMap<QToolBar *, QList<QAction *> > toolBars; - QMap<QToolBar *, QList<QAction *> > toolBarsWithSeparators; - QMap<QToolBar *, QList<QAction *> > defaultToolBars; + QHash<QToolBar *, QList<QAction *>> toolBars; + QHash<QToolBar *, QList<QAction *>> toolBarsWithSeparators; + QHash<QToolBar *, QList<QAction *>> defaultToolBars; QList<QToolBar *> customToolBars; QMainWindow *theMainWindow{nullptr}; @@ -134,7 +135,7 @@ QToolBar *QtFullToolBarManagerPrivate::toolBarWidgetAction(QAction *action) cons return 0; } -void QtFullToolBarManagerPrivate::removeWidgetActions(const QMap<QToolBar *, QList<QAction *> > +void QtFullToolBarManagerPrivate::removeWidgetActions(const QHash<QToolBar *, QList<QAction *>> &actions) { auto itToolBar = actions.constBegin(); @@ -543,7 +544,7 @@ void QtFullToolBarManager::removeDefaultToolBar(QToolBar *toolBar) } } -QMap<QToolBar *, QList<QAction *> > QtFullToolBarManager::defaultToolBars() const +QHash<QToolBar *, QList<QAction *>> QtFullToolBarManager::defaultToolBars() const { return d_ptr->defaultToolBars; } @@ -593,7 +594,7 @@ QList<QAction *> QtFullToolBarManager::actions(QToolBar *toolBar) const return QList<QAction *>(); } -void QtFullToolBarManager::setToolBars(const QMap<QToolBar *, QList<QAction *> > &actions) +void QtFullToolBarManager::setToolBars(const QHash<QToolBar *, QList<QAction *>> &actions) { auto it = actions.constBegin(); while (it != actions.constEnd()) { @@ -612,7 +613,7 @@ void QtFullToolBarManager::setToolBar(QToolBar *toolBar, const QList<QAction *> if (actions == d_ptr->toolBars[toolBar]) return; - QMap<QToolBar *, QList<QAction *> > toRemove; + QHash<QToolBar *, QList<QAction *>> toRemove; QList<QAction *> newActions; for (QAction *action : actions) { @@ -657,7 +658,7 @@ void QtFullToolBarManager::setToolBar(QToolBar *toolBar, const QList<QAction *> d_ptr->toolBarsWithSeparators.insert(toolBar, newActionsWithSeparators); } -QMap<QToolBar *, QList<QAction *> > QtFullToolBarManager::toolBarsActions() const +QHash<QToolBar *, QList<QAction *>> QtFullToolBarManager::toolBarsActions() const { return d_ptr->toolBars; } @@ -955,8 +956,8 @@ public: void clearOld(); void fillNew(); QtFullToolBarManager *toolBarManager; - QMap<ToolBarItem *, QList<QAction *> > currentState; - QMap<QToolBar *, ToolBarItem *> toolBarItems; + QHash<ToolBarItem *, QList<QAction *>> currentState; + QHash<QToolBar *, ToolBarItem *> toolBarItems; QSet<ToolBarItem *> createdItems; QSet<ToolBarItem *> removedItems; @@ -964,20 +965,20 @@ public: // static QTreeWidgetItem *currentAction; - QMap<QAction *, QTreeWidgetItem *> actionToItem; - QMap<QTreeWidgetItem *, QAction *> itemToAction; + QHash<QAction *, QTreeWidgetItem *> actionToItem; + QHash<QTreeWidgetItem *, QAction *> itemToAction; // dynamic ToolBarItem *currentToolBar; - QMap<ToolBarItem *, QListWidgetItem *> toolBarToItem; - QMap<QListWidgetItem *, ToolBarItem *> itemToToolBar; + QHash<ToolBarItem *, QListWidgetItem *> toolBarToItem; + QHash<QListWidgetItem *, ToolBarItem *> itemToToolBar; // dynamic - QMap<QAction *, QListWidgetItem *> actionToCurrentItem; - QMap<QListWidgetItem *, QAction *> currentItemToAction; + QHash<QAction *, QListWidgetItem *> actionToCurrentItem; + QHash<QListWidgetItem *, QAction *> currentItemToAction; - QMap<QAction *, ToolBarItem *> widgetActionToToolBar; - QMap<ToolBarItem *, QSet<QAction *> > toolBarToWidgetActions; + QHash<QAction *, ToolBarItem *> widgetActionToToolBar; + QHash<ToolBarItem *, QSet<QAction *>> toolBarToWidgetActions; QString separatorText; Ui::QtToolBarDialog ui; |