From 50b3837c6420865f46911f7359040dcb65fc112f Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 20 Jun 2017 10:41:57 +0200 Subject: Autogen: Q_OBJECT behind brace test --- Tests/QtAutogen/CMakeLists.txt | 24 +++++++++++++++--------- Tests/QtAutogen/mocOnlySource/StyleA.cpp | 5 +++++ Tests/QtAutogen/mocOnlySource/StyleA.hpp | 15 +++++++++++++++ Tests/QtAutogen/mocOnlySource/StyleB.cpp | 5 +++++ Tests/QtAutogen/mocOnlySource/StyleB.hpp | 16 ++++++++++++++++ Tests/QtAutogen/mocOnlySource/main.cpp | 9 +++++++++ 6 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 Tests/QtAutogen/mocOnlySource/StyleA.cpp create mode 100644 Tests/QtAutogen/mocOnlySource/StyleA.hpp create mode 100644 Tests/QtAutogen/mocOnlySource/StyleB.cpp create mode 100644 Tests/QtAutogen/mocOnlySource/StyleB.hpp create mode 100644 Tests/QtAutogen/mocOnlySource/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 3c6b2b3..89d2b80 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -61,6 +61,21 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test +# MOC only +add_executable(mocOnly mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp) +set_property(TARGET mocOnly PROPERTY AUTOMOC ON) +target_link_libraries(mocOnly ${QT_LIBRARIES}) + +# -- Test +# UIC only +if(ALLOW_WRAP_CPP) + qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h) + add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc}) + set_property(TARGET uicOnly PROPERTY AUTOUIC ON) + target_link_libraries(uicOnly ${QT_LIBRARIES}) +endif() + +# -- Test # RCC only add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc) set_property(TARGET rccOnly PROPERTY AUTORCC ON) @@ -73,15 +88,6 @@ set_property(TARGET rccEmpty PROPERTY AUTORCC ON) target_link_libraries(rccEmpty ${QT_QTCORE_TARGET}) # -- Test -# UIC only -if(ALLOW_WRAP_CPP) - qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h) - add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc}) - set_property(TARGET uicOnly PROPERTY AUTOUIC ON) - target_link_libraries(uicOnly ${QT_LIBRARIES}) -endif() - -# -- Test # Add not_generated_file.qrc to the source list to get the file-level # dependency, but don't generate a c++ file from it. Disable the AUTORCC # feature for this target. This tests that qrc files in the sources don't diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.cpp b/Tests/QtAutogen/mocOnlySource/StyleA.cpp new file mode 100644 index 0000000..ced1dd1 --- /dev/null +++ b/Tests/QtAutogen/mocOnlySource/StyleA.cpp @@ -0,0 +1,5 @@ +#include "StyleA.hpp" + +StyleA::StyleA() +{ +} diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.hpp b/Tests/QtAutogen/mocOnlySource/StyleA.hpp new file mode 100644 index 0000000..66735b6 --- /dev/null +++ b/Tests/QtAutogen/mocOnlySource/StyleA.hpp @@ -0,0 +1,15 @@ +#ifndef STYLEA_HPP +#define STYLEA_HPP + +#include + +/// Q_OBJECT on a single new line +/// +class StyleA : public QObject +{ + Q_OBJECT +public: + StyleA(); +}; + +#endif diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.cpp b/Tests/QtAutogen/mocOnlySource/StyleB.cpp new file mode 100644 index 0000000..bec6c1c --- /dev/null +++ b/Tests/QtAutogen/mocOnlySource/StyleB.cpp @@ -0,0 +1,5 @@ +#include "StyleB.hpp" + +StyleB::StyleB() +{ +} diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.hpp b/Tests/QtAutogen/mocOnlySource/StyleB.hpp new file mode 100644 index 0000000..425daf8 --- /dev/null +++ b/Tests/QtAutogen/mocOnlySource/StyleB.hpp @@ -0,0 +1,16 @@ +#ifndef STYLEB_HPP +#define STYLEB_HPP + +#include + +/* clang-format off */ +/// Q_OBJECT behind a brace +/// +class StyleB : public QObject +{ Q_OBJECT +public: + StyleB(); +}; +/* clang-format on */ + +#endif diff --git a/Tests/QtAutogen/mocOnlySource/main.cpp b/Tests/QtAutogen/mocOnlySource/main.cpp new file mode 100644 index 0000000..06f8d81 --- /dev/null +++ b/Tests/QtAutogen/mocOnlySource/main.cpp @@ -0,0 +1,9 @@ +#include "StyleA.hpp" +#include "StyleB.hpp" + +int main(int argv, char** args) +{ + StyleA styleA; + StyleB styleB; + return 0; +} -- cgit v0.12