diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-05-29 00:55:59 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-06-05 23:35:20 +0300 |
commit | 3ee289e40d1a7d3582cb1a3a304e681d2085bb82 (patch) | |
tree | 041797484bfaa5a351bd9f7c5ef071872232d4ff /src/widgets/kernel/qaction_widgets.cpp | |
parent | 794dbfe0a03cc70626ecab7b4efb089e21e6e9cf (diff) |
Misc.: fix narrowing conversion warnings
Using:
- range-for and iterator-based loops
- QList constructor that takes a pair of iterators
Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses, e.g. adding this to clangd's config file
(see https://clangd.llvm.org/config):
CompileFlags:
Add: [-Wshorten-64-to-32]
Pick-to: 6.6 6.5
Change-Id: I13ae65e09ab59a59f9e5c189ea27e4e16527df2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/kernel/qaction_widgets.cpp')
-rw-r--r-- | src/widgets/kernel/qaction_widgets.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/kernel/qaction_widgets.cpp b/src/widgets/kernel/qaction_widgets.cpp index 53b6e13b2d..ad282ab104 100644 --- a/src/widgets/kernel/qaction_widgets.cpp +++ b/src/widgets/kernel/qaction_widgets.cpp @@ -28,8 +28,9 @@ void QtWidgetsActionPrivate::destroy() { Q_Q(QAction); const auto objects = associatedObjects; - for (int i = objects.size()-1; i >= 0; --i) { - QObject *object = objects.at(i); + const auto end = objects.crend(); + for (auto it = objects.crbegin(); it != end; ++it) { + QObject *object = *it; if (QWidget *widget = qobject_cast<QWidget*>(object)) widget->removeAction(q); #if QT_CONFIG(graphicsview) |