summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/shared/qdesigner_menu.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-07-19 17:50:22 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-21 15:44:16 +0000
commit13d256d114054292887c911312221e61719e2553 (patch)
treeb27529751f17758f4379884f7b51585fa0577936 /src/designer/src/lib/shared/qdesigner_menu.cpp
parent68a2fb3ea9e69013f84ee71065515d7c05dfa916 (diff)
Designer: port away from the deprecated QAction APIs
The deprecation of QAction::associatedWidgets() results in a bit more code, because the list of associated objects can also contain QGraphicsWidget instances. So we need to explicitly qobject_cast them to QWidget* before using. Apart from that the changes are rather straightforward. Task-number: QTBUG-104968 Change-Id: I2e7c94de069cd5c9cde5e6d41ac86004a8bae6c9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit ca8a71e1997650a0ecf497d667cfab5a72858c18) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_menu.cpp')
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_menu.cpp b/src/designer/src/lib/shared/qdesigner_menu.cpp
index a098c757c..a2c8793c7 100644
--- a/src/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menu.cpp
@@ -1035,16 +1035,15 @@ QDesignerMenu *QDesignerMenu::findOrCreateSubMenu(QAction *action)
bool QDesignerMenu::canCreateSubMenu(QAction *action) const // ### improve it's a bit too slow
{
- const QWidgetList &associatedWidgets = action->associatedWidgets();
- for (const QWidget *aw : associatedWidgets) {
- if (aw != this) {
- if (const QMenu *m = qobject_cast<const QMenu *>(aw)) {
+ const QObjectList associatedObjects = action->associatedObjects();
+ for (const QObject *ao : associatedObjects) {
+ if (ao != this) {
+ if (const QMenu *m = qobject_cast<const QMenu *>(ao)) {
if (m->actions().contains(action))
return false; // sorry
- } else {
- if (const QToolBar *tb = qobject_cast<const QToolBar *>(aw))
- if (tb->actions().contains(action))
- return false; // sorry
+ } else if (const QToolBar *tb = qobject_cast<const QToolBar *>(ao)) {
+ if (tb->actions().contains(action))
+ return false; // sorry
}
}
}