diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutomoc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/QtAutomoc/foo.cpp | 39 | ||||
-rw-r--r-- | Tests/QtAutomoc/foo.h | 28 | ||||
-rw-r--r-- | Tests/QtAutomoc/main.cpp | 4 |
4 files changed, 72 insertions, 1 deletions
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index 4a5ff10..01f6bea 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -13,7 +13,7 @@ add_definitions(-DFOO) # create an executable and a library target, both requiring automoc: add_library(codeeditorLib STATIC codeeditor.cpp) -add_executable(foo main.cpp calwidget.cpp ) +add_executable(foo main.cpp calwidget.cpp foo.cpp) set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutomoc/foo.cpp b/Tests/QtAutomoc/foo.cpp new file mode 100644 index 0000000..699ba09 --- /dev/null +++ b/Tests/QtAutomoc/foo.cpp @@ -0,0 +1,39 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2004-2011 Kitware, Inc. + Copyright 2011 Alexander Neundorf (neundorf@kde.org) + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "foo.h" + +#include <stdio.h> + +class FooFoo : public QObject +{ + Q_OBJECT + public: + FooFoo():QObject() {} + public slots: + int getValue() const { return 12; } +}; + +Foo::Foo() +:QObject() +{ +} + + +void Foo::doFoo() +{ + FooFoo ff; + printf("Hello automoc: %d\n", ff.getValue()); +} + +#include "foo.moc" diff --git a/Tests/QtAutomoc/foo.h b/Tests/QtAutomoc/foo.h new file mode 100644 index 0000000..32d4c8d --- /dev/null +++ b/Tests/QtAutomoc/foo.h @@ -0,0 +1,28 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2004-2011 Kitware, Inc. + Copyright 2011 Alexander Neundorf (neundorf@kde.org) + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef FOO_H +#define FOO_H + +#include <QObject> + +class Foo : public QObject +{ + Q_OBJECT + public: + Foo(); + public slots: + void doFoo(); +}; + +#endif diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutomoc/main.cpp index 7bf4a5d..b7cfb41 100644 --- a/Tests/QtAutomoc/main.cpp +++ b/Tests/QtAutomoc/main.cpp @@ -42,6 +42,7 @@ #include "codeeditor.h" #include "calwidget.h" +#include "foo.h" int main(int argv, char **args) { @@ -54,5 +55,8 @@ int main(int argv, char **args) Window w; w.show(); + Foo foo; + foo.doFoo(); + return app.exec(); } |