From dd4984aab0725269c7b5f453cbff44e9d8c5c756 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sat, 31 Dec 2011 14:32:38 +0100 Subject: [PATCH] #1095 --- demos/qt4/foo.cpp | 14 ++++++++++++++ waflib/Tools/qt4.py | 17 +++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/demos/qt4/foo.cpp b/demos/qt4/foo.cpp index 45075687..4c03b062 100644 --- a/demos/qt4/foo.cpp +++ b/demos/qt4/foo.cpp @@ -6,6 +6,20 @@ Foo::Foo() : QWidget(NULL) { } +/* WARNING: do not declare private classes in .cpp files (put them in header files) */ + +class Bar_private : public QWidget { + Q_OBJECT + signals: + void test(); + public: + Bar_private(); +}; + +Bar_private::Bar_private() : QWidget(NULL) { +} + #if WAF #include "foo.moc" +#include "foo.cpp.moc" #endif diff --git a/waflib/Tools/qt4.py b/waflib/Tools/qt4.py index 77eeb3b3..db802a4f 100644 --- a/waflib/Tools/qt4.py +++ b/waflib/Tools/qt4.py @@ -160,14 +160,23 @@ class qxx(cxx.cxx): h_node = x.find_node(base2 + e) if h_node: break - else: - continue - break + if h_node: + m_node = h_node.change_ext('.moc') + break else: + for k in EXT_QT4: + if base2.endswith(k): + for x in [node.parent] + self.generator.includes_nodes: + h_node = x.find_node(base2) + if h_node: + break + if h_node: + m_node = h_node.change_ext(k + '.moc') + break + if not h_node: raise Errors.WafError('no header found for %r which is a moc file' % d) # next time we will not search for the extension (look at the 'for' loop below) - m_node = h_node.change_ext('.moc') bld.node_deps[(self.inputs[0].parent.abspath(), m_node.name)] = h_node # create the task