summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp4
-rw-r--r--src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp8
-rw-r--r--src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp8
-rw-r--r--src/gui/doc/snippets/textdocument-printing/mainwindow.cpp8
-rw-r--r--src/gui/doc/snippets/textdocument-selections/mainwindow.cpp4
-rw-r--r--src/widgets/CMakeLists.txt10
-rw-r--r--src/widgets/widgets/qmenu.cpp147
-rw-r--r--src/widgets/widgets/qmenu.h89
-rw-r--r--src/widgets/widgets/qtoolbar.cpp111
-rw-r--r--src/widgets/widgets/qtoolbar.h49
-rw-r--r--src/widgets/widgets/qtwidgets_widgets_removed_functions_in_6_3.cpp102
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp13
12 files changed, 205 insertions, 348 deletions
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
index 4be214ad64..6ba5bde2e0 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp
@@ -78,8 +78,8 @@ QKeySequence(Qt::CTRL + Qt::Key_X, Qt::CTRL + Qt::Key_C); // deprecated
void Wrapper::wrapper() {
//! [2]
QMenu *file = new QMenu(this);
-file->addAction(tr("&Open..."), this, SLOT(open()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
+file->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")),
+ this, SLOT(open()));
//! [2]
} // Wrapper::wrapper
diff --git a/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
index 5179208f61..119cf1b5f7 100644
--- a/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp
@@ -59,8 +59,8 @@ MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
+ fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")),
+ this, SLOT(close()));
QMenu *actionsMenu = new QMenu(tr("&Actions"));
actionsMenu->addAction(tr("&Highlight List Items"),
@@ -69,8 +69,8 @@ MainWindow::MainWindow()
QMenu *insertMenu = new QMenu(tr("&Insert"));
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
+ insertMenu->addAction(tr("&List"), QKeySequence(tr("Ctrl+L", "Insert|List")),
+ this, SLOT(insertList()));
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(insertMenu);
diff --git a/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
index dcf28b92ba..49f96bff18 100644
--- a/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-listitemstyles/mainwindow.cpp
@@ -57,13 +57,13 @@ MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
+ fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")),
+ this, SLOT(close()));
QMenu *insertMenu = new QMenu(tr("&Insert"));
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
+ insertMenu->addAction(tr("&List"), QKeySequence(tr("Ctrl+L", "Insert|List")),
+ this, SLOT(insertList()));
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(insertMenu);
diff --git a/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp b/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
index bccbef178e..60d94a99ba 100644
--- a/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-printing/mainwindow.cpp
@@ -60,8 +60,8 @@ MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
+ fileMenu->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open"))
+ this, SLOT(openFile()));
printAction = fileMenu->addAction(tr("&Print..."), this, SLOT(printFile()));
printAction->setEnabled(false);
@@ -69,8 +69,8 @@ MainWindow::MainWindow()
pdfPrintAction = fileMenu->addAction(tr("Print as P&DF..."), this, SLOT(printPdf()));
pdfPrintAction->setEnabled(false);
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
+ fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")),
+ this, SLOT(close()));
menuBar()->addMenu(fileMenu);
diff --git a/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
index 3e491151bc..ef25fa9112 100644
--- a/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp
@@ -55,8 +55,8 @@ MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"));
- fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
+ fileMenu->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")),
+ this, SLOT(openFile()));
QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, SLOT(close()));
quitAction->setShortcut(tr("Ctrl+Q"));
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index be84ec8e1f..324a26d07d 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -47,6 +47,7 @@ qt_internal_add_module(Widgets
widgets/qabstractscrollarea.cpp widgets/qabstractscrollarea.h widgets/qabstractscrollarea_p.h
widgets/qfocusframe.cpp widgets/qfocusframe.h
widgets/qframe.cpp widgets/qframe.h widgets/qframe_p.h
+ widgets/qtwidgets_widgets_removed_functions_in_6_3.cpp
widgets/qwidgetanimator.cpp widgets/qwidgetanimator_p.h
DEFINES
QT_NO_USING_NAMESPACE
@@ -237,6 +238,15 @@ set(qstyle_resource_files
"styles/images/viewlist-32.png"
)
+set(widgets_no_pch_sources
+ widgets/qtwidgets_widgets_removed_functions_in_6_3.cpp
+)
+
+foreach(src ${widgets_no_pch_sources})
+ qt_update_ignore_pch_source(Widgets ${src})
+endforeach()
+
+
qt_internal_add_resource(Widgets "qstyle"
PREFIX
"/qt-project.org/styles/commonstyle"
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 282cbe420f..9612e11c01 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1757,162 +1757,75 @@ QMenu::~QMenu()
hideTearOffMenu();
}
+#if QT_DEPRECATED_SINCE(6, 4)
/*!
- 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.
+ \fn QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut)
+ \obsolete
- QMenu takes ownership of the returned QAction.
-
- \sa QWidget::addAction()
-*/
-QAction *QMenu::addAction(const QString &text)
-{
- QAction *ret = new QAction(text, this);
- addAction(ret);
- return ret;
-}
-
-/*!
- \overload
-
- This convenience function creates a new action with an \a icon
- and some \a text. The function adds the newly created action to
- the menu's list of actions, and returns it.
-
- QMenu takes ownership of the returned QAction.
-
- \sa QWidget::addAction()
-*/
-QAction *QMenu::addAction(const QIcon &icon, const QString &text)
-{
- QAction *ret = new QAction(icon, text, this);
- addAction(ret);
- return ret;
-}
-
-/*!
- \overload
-
- This convenience function creates a new action with the text \a
- text and an optional shortcut \a shortcut. The action's
- \l{QAction::triggered()}{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.
-
- QMenu takes ownership of the returned QAction.
-
- \sa QWidget::addAction()
+ Use \c{QWidget::addAction(text, shortcut, receiver, member)} instead.
*/
-QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member
#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut
-#endif
- )
+QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut)
{
- QAction *action = new QAction(text, this);
-#if QT_CONFIG(shortcut)
- action->setShortcut(shortcut);
-#endif
- QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
- addAction(action);
- return action;
+ return QWidget::addAction(text, shortcut, receiver, member);
}
+#endif
-/*!\fn template<typename Functor> QAction *QMenu::addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0)
+/*!
+ \fn template<typename Functor> QAction *QMenu::addAction(const QString &text, Functor functor, const QKeySequence &shortcut)
\since 5.6
+ \obsolete
- \overload
-
- This convenience function creates a new action with the text \a
- text and an optional shortcut \a shortcut. The action's
- \l{QAction::triggered()}{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.
-
- QMenu takes ownership of the returned QAction.
+ Use QWidget::addAction(text, shortcut, functor) instead.
*/
-/*!\fn template<typename Functor> QAction *QMenu::addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut)
+/*!
+ \fn template<typename Functor> QAction *QMenu::addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut)
\since 5.6
+ \obsolete
- \overload
-
- This convenience function creates a new action with the text \a
- text and an optional shortcut \a shortcut. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a functor. The functor can be a pointer to a member function of
- the \a context object. The newly created action is added to the
- menu's list of actions and a pointer to it is returned.
-
- If the \a context object is destroyed, the functor will not be called.
-
- QMenu takes ownership of the returned QAction.
+ Use QWidget::addAction(text, shortcut, context, functor) instead.
*/
-/*!\fn template<typename Functor> QAction *QMenu::addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0)
+/*!
+ \fn template<typename Functor> QAction *QMenu::addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut)
\since 5.6
+ \obsolete
- \overload
-
- This convenience function creates a new action with an \a icon
- and some \a text and an optional shortcut \a shortcut. The action's
- \l{QAction::triggered()}{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.
-
- QMenu takes ownership of the returned QAction.
+ Use QWidget::addAction(icon, text, shortcut, functor) instead.
*/
-/*!\fn template<typename Functor> QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut)
+/*!
+ \fn template<typename Functor> QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut)
\since 5.6
+ \obsolete
- \overload
-
- This convenience function creates a new action with an \a icon
- and some \a text and an optional shortcut \a shortcut. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a functor. The \a functor can be a pointer to a member function
- of the \a context object. The newly created action is added to the
- menu's list of actions and a pointer to it is returned.
-
- If \a context is destroyed, the functor will not be called.
-
- QMenu takes ownership of the returned QAction.
+ Use QWidget::addAction(icon, text, shortcut, context, functor) instead.
*/
/*!
- \overload
+ \fn QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut)
- This convenience function creates a new action with an \a icon and
- some \a text and an optional shortcut \a shortcut. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a member slot of the \a receiver object. The function adds the
- newly created action to the menu's list of actions, and returns it.
+ \obsolete
- QMenu takes ownership of the returned QAction.
-
- \sa QWidget::addAction()
+ Use QWidget::addAction(icon, text, shortcut, receiver, member) instead.
*/
-QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver,
- const char* member
#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut
-#endif
- )
+QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver,
+ const char* member, const QKeySequence &shortcut)
{
QAction *action = new QAction(icon, text, this);
-#if QT_CONFIG(shortcut)
action->setShortcut(shortcut);
-#endif
QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
addAction(action);
return action;
}
+#endif
+#endif // QT_DEPRECATED_SINCE(6, 4)
/*!
This convenience function adds \a menu as a submenu to this menu.
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index f7348529e2..73058c165c 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -76,96 +76,71 @@ public:
~QMenu();
using QWidget::addAction;
+#ifdef QT_BUILD_FUNCTIONS_REMOVED_IN_6_3
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
-
- QAction *addAction(const QString &text, const QObject *receiver, const char* member
-#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut = {}
+#if !QT_CONFIG(shortcut)
+ QAction *addAction(const QString &text, const QObject *receiver, const char* member);
+ QAction *addAction(const QIcon &icon, const QString &text,
+ const QObject *receiver, const char* member);
#endif
- );
- QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member
-#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut = {}
#endif
- );
+
+#if QT_CONFIG(shortcut)
+#if QT_DEPRECATED_SINCE(6, 4)
+ QT_DEPRECATED_VERSION_X_6_4("Use addAction(text, shortcut, receiver, member) instead.")
+ QAction *addAction(const QString &text, const QObject *receiver, const char* member,
+ const QKeySequence &shortcut);
+ QT_DEPRECATED_VERSION_X_6_4("Use addAction(icon, text, shortcut, receiver, member) instead.")
+ QAction *addAction(const QIcon &icon, const QString &text,
+ const QObject *receiver, const char* member,
+ const QKeySequence &shortcut);
#ifdef Q_CLANG_QDOC
template<typename Functor>
- QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0);
+ QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut);
template<typename Functor>
- QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0);
+ QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut);
template<typename Functor>
- QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0);
+ QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut);
template<typename Functor>
- QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0);
+ QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut);
#else
// addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
template<class 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
-#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut = {}
-#endif
- )
+ addAction(const QString &text, const Obj *object, Func1 slot,
+ const QKeySequence &shortcut)
{
- QAction *result = addAction(text);
-#if QT_CONFIG(shortcut)
- result->setShortcut(shortcut);
-#endif
- connect(result, &QAction::triggered, object, std::move(slot));
- return result;
+ return addAction(text, shortcut, object, slot);
}
// addAction(QString): Connect to a functor or function pointer (without context)
template <typename Func1>
- inline QAction *addAction(const QString &text, Func1 slot
-#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut = {}
-#endif
- )
+ inline QAction *addAction(const QString &text, Func1 slot, const QKeySequence &shortcut)
{
- QAction *result = addAction(text);
-#if QT_CONFIG(shortcut)
- result->setShortcut(shortcut);
-#endif
- connect(result, &QAction::triggered, std::move(slot));
- return result;
+ return addAction(text, shortcut, slot);
}
// addAction(QIcon, QString): Connect to a QObject slot / functor or function pointer (with context)
template<class Obj, typename Func1>
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
- addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot
-#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut = {}
-#endif
- )
+ addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot,
+ const QKeySequence &shortcut)
{
- QAction *result = addAction(actionIcon, text);
-#if QT_CONFIG(shortcut)
- result->setShortcut(shortcut);
-#endif
- connect(result, &QAction::triggered, object, std::move(slot));
- return result;
+ return addAction(actionIcon, text, shortcut, object, slot);
}
// addAction(QIcon, QString): Connect to a functor or function pointer (without context)
template <typename Func1>
- inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot
-#if QT_CONFIG(shortcut)
- , const QKeySequence &shortcut = {}
-#endif
- )
+ inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot,
+ const QKeySequence &shortcut)
{
- QAction *result = addAction(actionIcon, text);
-#if QT_CONFIG(shortcut)
- result->setShortcut(shortcut);
-#endif
- connect(result, &QAction::triggered, std::move(slot));
- return result;
+ return addAction(actionIcon, text, shortcut, slot);
}
#endif // !Q_CLANG_QDOC
+#endif // QT_DEPRECATED_SINCE(6, 4)
+#endif // QT_CONFIG(shortcut)
QAction *addMenu(QMenu *menu);
QMenu *addMenu(const QString &title);
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index e69c08a251..169fbf5de8 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -737,117 +737,6 @@ void QToolBar::clear()
}
/*!
- Creates a new action with the given \a text. This action is added to
- the end of the toolbar.
-*/
-QAction *QToolBar::addAction(const QString &text)
-{
- QAction *action = new QAction(text, this);
- addAction(action);
- return action;
-}
-
-/*!
- \overload
-
- Creates a new action with the given \a icon and \a text. This
- action is added to the end of the toolbar.
-*/
-QAction *QToolBar::addAction(const QIcon &icon, const QString &text)
-{
- QAction *action = new QAction(icon, text, this);
- addAction(action);
- return action;
-}
-
-/*!
- \overload
-
- Creates a new action with the given \a text. This action is added to
- the end of the toolbar. The action's \l{QAction::triggered()}{triggered()}
- signal is connected to \a member in \a receiver.
-*/
-QAction *QToolBar::addAction(const QString &text,
- const QObject *receiver, const char* member)
-{
- QAction *action = new QAction(text, this);
- QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
- addAction(action);
- return action;
-}
-
-/*!
- \overload
-
- Creates a new action with the given \a icon and \a text. This
- action is added to the end of the toolbar. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to \a
- member in \a receiver.
-*/
-QAction *QToolBar::addAction(const QIcon &icon, const QString &text,
- const QObject *receiver, const char* member)
-{
- QAction *action = new QAction(icon, text, this);
- QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
- addAction(action);
- return action;
-}
-
-/*!\fn template<typename Functor> QAction *QToolBar::addAction(const QString &text, Functor functor)
-
- \since 5.6
-
- \overload
-
- Creates a new action with the given \a text. This action is added to
- the end of the toolbar. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a functor.
-*/
-
-/*!\fn template<typename Functor> QAction *QToolBar::addAction(const QString &text, const QObject *context, Functor functor)
-
- \since 5.6
-
- \overload
-
- Creates a new action with the given \a text. This action is added
- to the end of the toolbar. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a functor. The \a functor can be a pointer to a member function
- in the \a context object.
-
- If the \a context object is destroyed, the \a functor will not be called.
-*/
-
-/*!\fn template<typename Functor> QAction *QToolBar::addAction(const QIcon &icon, const QString &text, Functor functor)
-
- \since 5.6
-
- \overload
-
- Creates a new action with the given \a icon and \a text. This
- action is added to the end of the toolbar. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a functor.
-*/
-
-/*!\fn template<typename Functor> QAction *QToolBar::addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor)
-
- \since 5.6
-
- \overload
-
- Creates a new action with the given \a icon and \a text. This
- action is added to the end of the toolbar. The action's
- \l{QAction::triggered()}{triggered()} signal is connected to the
- \a functor. The \a functor can be a pointer to a member function
- of the \a context object.
-
- If the \a context object is destroyed, the \a functor will not be called.
-*/
-
-/*!
Adds a separator to the end of the toolbar.
\sa insertSeparator()
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 54dfd51071..caca716d2e 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -90,58 +90,13 @@ public:
void clear();
using QWidget::addAction;
+#ifdef QT_BUILD_FUNCTIONS_REMOVED_IN_6_3
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
QAction *addAction(const QString &text, const QObject *receiver, const char* member);
QAction *addAction(const QIcon &icon, const QString &text,
const QObject *receiver, const char* member);
-#ifdef Q_CLANG_QDOC
- template<typename Functor>
- QAction *addAction(const QString &text, Functor functor);
- template<typename Functor>
- QAction *addAction(const QString &text, const QObject *context, Functor functor);
- template<typename Functor>
- QAction *addAction(const QIcon &icon, const QString &text, Functor functor);
- template<typename Functor>
- QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor);
-#else
- // addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
- template<class 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, slot);
- return result;
- }
- // addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
- template<class Obj, typename Func1>
- inline typename std::enable_if<!std::is_same<const char*, Func1>::value
- && QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
- addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot)
- {
- QAction *result = addAction(actionIcon, text);
- connect(result, &QAction::triggered, object, std::move(slot));
- return result;
- }
- // addAction(QIcon, QString): Connect to a functor or function pointer (without context)
- template <typename Func1>
- inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot)
- {
- QAction *result = addAction(actionIcon, text);
- connect(result, &QAction::triggered, slot);
- return result;
- }
-#endif // !Q_CLANG_QDOC
+#endif
QAction *addSeparator();
QAction *insertSeparator(QAction *before);
diff --git a/src/widgets/widgets/qtwidgets_widgets_removed_functions_in_6_3.cpp b/src/widgets/widgets/qtwidgets_widgets_removed_functions_in_6_3.cpp
new file mode 100644
index 0000000000..535aec8ce4
--- /dev/null
+++ b/src/widgets/widgets/qtwidgets_widgets_removed_functions_in_6_3.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define QT_BUILD_FUNCTIONS_REMOVED_IN_6_3
+
+#include "qglobal.h"
+
+QT_USE_NAMESPACE
+
+#if QT_DEPRECATED_SINCE(6, 3)
+
+#include "qmenu.h"
+
+QAction *QMenu::addAction(const QString &text)
+{
+ return QWidget::addAction(text);
+}
+
+QAction *QMenu::addAction(const QIcon &icon, const QString &text)
+{
+ return QWidget::addAction(icon, text);
+}
+
+#if !QT_CONFIG(shortcut)
+// the overloads taking QKeySequence as a trailing argument are deprecated, not removed,
+// so remained in qmenu.cpp
+QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member)
+{
+ return QWidget::addAction(text, receiver, member);
+}
+
+QAction *QMenu::addAction(const QIcon &icon, const QString &text,
+ const QObject *receiver, const char* member)
+{
+ return QWidget::addAction(icon, text, receiver, member);
+}
+#endif
+
+#include "qtoolbar.h"
+
+QAction *QToolBar::addAction(const QString &text)
+{
+ return QWidget::addAction(text);
+}
+
+QAction *QToolBar::addAction(const QIcon &icon, const QString &text)
+{
+ return QWidget::addAction(icon, text);
+}
+
+QAction *QToolBar::addAction(const QString &text,
+ const QObject *receiver, const char* member)
+{
+ return QWidget::addAction(text, receiver, member);
+}
+
+QAction *QToolBar::addAction(const QIcon &icon, const QString &text,
+ const QObject *receiver, const char* member)
+{
+ return QWidget::addAction(icon, text, receiver, member);
+}
+
+// #include <qotherheader.h>
+// // implement removed functions from qotherheader.h
+
+#endif // QT_DEPRECATED_SINCE(6, 3)
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 1ca51cd1a9..55345f2ae5 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -304,6 +304,9 @@ void tst_QMenu::addActionsConnect()
menu.addAction(icon, text, &menu, testFunction);
#ifndef QT_NO_SHORTCUT
const QKeySequence keySequence(Qt::CTRL | Qt::Key_C);
+#if QT_DEPRECATED_SINCE(6, 4)
+ QT_WARNING_PUSH
+ QT_WARNING_DISABLE_DEPRECATED
menu.addAction(text, &menu, SLOT(deleteLater()), keySequence);
menu.addAction(text, &menu, &QMenu::deleteLater, keySequence);
menu.addAction(text, testFunction, keySequence);
@@ -312,6 +315,16 @@ void tst_QMenu::addActionsConnect()
menu.addAction(icon, text, &menu, &QMenu::deleteLater, keySequence);
menu.addAction(icon, text, testFunction, keySequence);
menu.addAction(icon, text, &menu, testFunction, keySequence);
+ QT_WARNING_POP
+#endif
+ menu.addAction(text, keySequence, &menu, SLOT(deleteLater()));
+ menu.addAction(text, keySequence, &menu, &QMenu::deleteLater);
+ menu.addAction(text, keySequence, testFunction);
+ menu.addAction(text, keySequence, &menu, testFunction);
+ menu.addAction(icon, text, keySequence, &menu, SLOT(deleteLater()));
+ menu.addAction(icon, text, keySequence, &menu, &QMenu::deleteLater);
+ menu.addAction(icon, text, keySequence, testFunction);
+ menu.addAction(icon, text, keySequence, &menu, testFunction);
#endif // !QT_NO_SHORTCUT
}