diff --git a/src/gui/kernel/qshortcut.h b/src/gui/kernel/qshortcut.h index dbdf6f97f9..d6b48c2817 100644 --- a/src/gui/kernel/qshortcut.h +++ b/src/gui/kernel/qshortcut.h @@ -170,7 +170,7 @@ public: bool autoRepeat() const; #if QT_DEPRECATED_SINCE(6,0) - Q_DECL_DEPRECATED int id() const; + QT_DEPRECATED_VERSION_6_0 int id() const; #endif void setWhatsThis(const QString &text); @@ -181,6 +181,7 @@ public: QWidget *parentWidget() const; #else template + QT_DEPRECATED_VERSION_X_6_0("Use parent() and qobject_cast instead") inline T parentWidget() const { return static_cast(QObject::parent()); } #endif diff --git a/src/widgets/kernel/qshortcut_widgets.cpp b/src/widgets/kernel/qshortcut_widgets.cpp index 968cc898d7..cb184ef07d 100644 --- a/src/widgets/kernel/qshortcut_widgets.cpp +++ b/src/widgets/kernel/qshortcut_widgets.cpp @@ -81,7 +81,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context) auto w = qobject_cast(object); if (!w) { if (auto s = qobject_cast(object)) - w = s->parentWidget(); + w = qobject_cast(s->parent()); } if (!w) {