diff --git a/src/widgets/compat/removed_api.cpp b/src/widgets/compat/removed_api.cpp index 3af337d8532..32f4e7c8069 100644 --- a/src/widgets/compat/removed_api.cpp +++ b/src/widgets/compat/removed_api.cpp @@ -96,6 +96,18 @@ QAction *QToolBar::addAction(const QIcon &icon, const QString &text, return QWidget::addAction(icon, text, receiver, member); } +#include "qmenubar.h" + +QAction *QMenuBar::addAction(const QString &text) +{ + return QWidget::addAction(text); +} + +QAction *QMenuBar::addAction(const QString &text, const QObject *receiver, const char* member) +{ + return QWidget::addAction(text, receiver, member); +} + // #include // // implement removed functions from qotherheader.h diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index f92a9754553..24a9fd8a0ad 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -750,72 +750,6 @@ QMenuBar::~QMenuBar() d->platformMenuBar = nullptr; } -/*! - This convenience function creates a new action with \a text. - The function adds the newly created action to the menu's - list of actions, and returns it. - - \sa QWidget::addAction(), QWidget::actions() -*/ -QAction *QMenuBar::addAction(const QString &text) -{ - QAction *ret = new QAction(text, this); - addAction(ret); - return ret; -} - -/*! - \overload - - This convenience function creates a new action with the given \a - text. The action's triggered() signal is connected to the \a - receiver's \a member slot. The function adds the newly created - action to the menu's list of actions and returns it. - - \sa QWidget::addAction(), QWidget::actions() -*/ -QAction *QMenuBar::addAction(const QString &text, const QObject *receiver, const char* member) -{ - QAction *ret = new QAction(text, this); - QObject::connect(ret, SIGNAL(triggered(bool)), receiver, member); - addAction(ret); - return ret; -} - -/*! - \fn template QAction *QMenuBar::addAction(const QString &text, const Obj *receiver, PointerToMemberFunctionOrFunctor method) - - \since 5.11 - - \overload - - This convenience function creates a new action with the given \a - text. The action's triggered() signal is connected to the - \a method of the \a receiver. The function adds the newly created - action to the menu's list of actions and returns it. - - QMenuBar takes ownership of the returned QAction. - - \sa QWidget::addAction(), QWidget::actions() -*/ - -/*! - \fn template QAction *QMenuBar::addAction(const QString &text, Functor functor) - - \since 5.11 - - \overload - - This convenience function creates a new action with the given \a - text. The action's triggered() signal is connected to the - \a functor. The function adds the newly created - action to the menu's list of actions and returns it. - - QMenuBar takes ownership of the returned QAction. - - \sa QWidget::addAction(), QWidget::actions() -*/ - /*! Appends a new QMenu with \a title to the menu bar. The menu bar takes ownership of the menu. Returns the new menu. @@ -1588,7 +1522,7 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) Returns the QAction at \a pt. Returns \nullptr if there is no action at \a pt or if the location has a separator. - \sa addAction(), addSeparator() + \sa QWidget::addAction(), addSeparator() */ QAction *QMenuBar::actionAt(const QPoint &pt) const { diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index f2170ebf5ad..43bcd39f71d 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -64,34 +64,10 @@ public: ~QMenuBar(); using QWidget::addAction; +#if QT_REMOVED_SINCE(6, 3) QAction *addAction(const QString &text); QAction *addAction(const QString &text, const QObject *receiver, const char* member); - -#ifdef Q_CLANG_QDOC - template - QAction *addAction(const QString &text, const Obj *receiver, PointerToMemberFunctionOrFunctor method); - template - QAction *addAction(const QString &text, Functor functor); -#else - // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) - template - inline typename std::enable_if::value - && QtPrivate::IsPointerToTypeDerivedFromQObject::Value, QAction *>::type - addAction(const QString &text, const Obj *object, Func1 slot) - { - QAction *result = addAction(text); - connect(result, &QAction::triggered, object, std::move(slot)); - return result; - } - // addAction(QString): Connect to a functor or function pointer (without context) - template - inline QAction *addAction(const QString &text, Func1 slot) - { - QAction *result = addAction(text); - connect(result, &QAction::triggered, std::move(slot)); - return result; - } -#endif // !Q_CLANG_QDOC +#endif QAction *addMenu(QMenu *menu); QMenu *addMenu(const QString &title);