From 51b7b494213643c9808efecf6a7372d3b63c6f50 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Jan 2017 08:44:21 +0000 Subject: Bindings: Correctly handle access specifiers within macros The Q_DECLARE_TR_FUNCTIONS macro contains a `public:` access specifier, but the sip_generator just pastes the entire macro name. Adjust the generator to extract the correct access specifier. --- find-modules/sip_generator.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'find-modules/sip_generator.py') diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index a67263ff..acdec86e 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -335,10 +335,22 @@ class SipGenerator(object): """ Skip access specifiers embedded in the Q_OBJECT macro. """ - access_specifier = self._read_source(member.extent) - if access_specifier == "Q_OBJECT": + access_specifier_text = self._read_source(member.extent) + if access_specifier_text == "Q_OBJECT": return "" pad = " " * ((level - 1) * 4) + access_specifier = "" + if (access_specifier_text in ("Q_SIGNALS:", "signals:", + "public Q_SLOTS:", "public slots:", + "protected Q_SLOTS:", "protected slots:")): + access_specifier = access_specifier_text + elif member.access_specifier == AccessSpecifier.PRIVATE: + access_specifier = "private:" + elif member.access_specifier == AccessSpecifier.PROTECTED: + access_specifier = "protected:" + elif member.access_specifier == AccessSpecifier.PUBLIC: + access_specifier = "public:" + decl = pad + access_specifier + "\n" return decl -- cgit v1.2.1