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>
This commit is contained in:
Marc Mutz 2021-07-13 19:23:36 +02:00
parent 99f0db695a
commit d3ecc6db29
3 changed files with 15 additions and 93 deletions

View File

@ -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

View File

@ -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<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
{

View File

@ -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);