From 22a487a08743e78944b161c33c004b9bcbb0dc34 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Jan 2017 22:02:15 +0000 Subject: Bindings: Add explicit handling of nullptr as a parameter default Don't prepend a namespace to it as we do otherwise with enum/flags. --- find-modules/sip_generator.py | 2 +- tests/GenerateSipBindings/cpplib.cpp | 5 +++++ tests/GenerateSipBindings/cpplib.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index 93a8f8c0..621fe711 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -590,7 +590,7 @@ class SipGenerator(object): return result def _get_param_value(text, parameterType): - if text == "0": + if text == "0" or text == "nullptr": return text if not "::" in parameterType.spelling: return text diff --git a/tests/GenerateSipBindings/cpplib.cpp b/tests/GenerateSipBindings/cpplib.cpp index 524a0936..e7cb1d17 100644 --- a/tests/GenerateSipBindings/cpplib.cpp +++ b/tests/GenerateSipBindings/cpplib.cpp @@ -100,6 +100,11 @@ int MyObject::localListDecl(const QList& l) return std::accumulate(l.begin(), l.end(), 0); } +void MyObject::enumNullptr(Qt::WindowFlags f) +{ + +} + LocalFwdDecl::LocalFwdDecl(int value) : m_value(value) { diff --git a/tests/GenerateSipBindings/cpplib.h b/tests/GenerateSipBindings/cpplib.h index dd797a9c..c54b6b7a 100644 --- a/tests/GenerateSipBindings/cpplib.h +++ b/tests/GenerateSipBindings/cpplib.h @@ -51,6 +51,8 @@ public: int functionParam(std::function fn); int groups(unsigned int maxCount = std::numeric_limits::max()) const; + void enumNullptr(Qt::WindowFlags f = nullptr); + int const_parameters(const int input, QObject* const obj = 0) const; int externalFwdDecl(const ExternalFwdDecl& f); -- cgit v1.2.1