diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2016-03-09 20:37:17 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2016-03-29 14:11:05 +0000 |
commit | 7d9cbc6b643b472304960842cd60ec4ba3319f37 (patch) | |
tree | 04cede6285e0663ac13267669439ab93a537e5e0 /src/widgets | |
parent | 09a1dd2fd4d76a7a7af64cc147b68fda50c17353 (diff) |
Fix Q_QDOC code for PointerToMemberFunction
In functions such as QObject::connect and similar which are using pointer
to member function or functor, we have a different declaration for qdoc
because we don't want to show the QEnableIf and other type traits in the
doc.
However, The code still needs to be valid, as we will use clang to parse
the documentation.
Fix it by making 'PointerToMemberFunction' and 'Functor' template
parameters (which they actually are).
Change-Id: Ie2648407bae21ba6d1677f6de2d6f597486b5c98
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qmenu.h | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbar.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 7dda38456a..2e579899bc 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -85,11 +85,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h index 774d47b913..c1d765598f 100644 --- a/src/widgets/widgets/qtoolbar.h +++ b/src/widgets/widgets/qtoolbar.h @@ -100,11 +100,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method); + 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 PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method); + 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) |