diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-07-13 19:23:36 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-28 02:01:21 +0200 |
commit | d3ecc6db293143bdd4a5da5f28144a7e145f257c (patch) | |
tree | fa49b2c9f9636ba5a58fc62507b241cdfedc51f1 /src/widgets | |
parent | 99f0db695ab54ba0cd88c6a53ddd2d712525ecc3 (diff) |
QMenuBar: remove addAction() functions
They're now in QWidget itself. Remove them from the API, but not the
ABI.
[ChangeLog][QtWidgets][QMenuBar] The addAction() functions have been
moved down into QWidget.
Change-Id: Iaa023ff227686e8e67a2b5594f0fbc31b95177a3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/compat/removed_api.cpp | 12 | ||||
-rw-r--r-- | src/widgets/widgets/qmenubar.cpp | 68 | ||||
-rw-r--r-- | src/widgets/widgets/qmenubar.h | 28 |
3 files changed, 15 insertions, 93 deletions
diff --git a/src/widgets/compat/removed_api.cpp b/src/widgets/compat/removed_api.cpp index 3af337d853..32f4e7c806 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 <qotherheader.h> // // implement removed functions from qotherheader.h diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index f92a975455..24a9fd8a0a 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -751,72 +751,6 @@ QMenuBar::~QMenuBar() } /*! - 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<typename Obj, typename PointerToMemberFunctionOrFunctor> 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<typename Functor> 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 f2170ebf5a..43bcd39f71 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<typename Obj, typename PointerToMemberFunctionOrFunctor> - QAction *addAction(const QString &text, const Obj *receiver, PointerToMemberFunctionOrFunctor method); - template<typename Functor> - QAction *addAction(const QString &text, Functor functor); -#else - // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) - template<typename Obj, typename Func1> - inline typename std::enable_if<!std::is_same<const char*, Func1>::value - && QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::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 <typename Func1> - 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); |