CMake: Introduce Q_OBJECT qdoc macro
CMake's moc file scanning is rather primitive: It will run moc on any file containing a line that starts with Q_OBJECT (and similar macros). We have four files in QtBase that contain such a macro at the start of the line in a qdoc comment. These four files were excluded from automatic moc handling by cmake, which is not ideal, since this will silently fail when somebody actually adds a Q_OBJECT macro in code. This patch introduces a macro Q_OBJECT for qdoc. This macro will be replaced with Q_OBJECT in the generated documentation. While not nice, at least a failure to use \Q_OBJECT is noticeable: Moc will warn about the file. Change-Id: I829893c1166eee306fe30058d4ea0256affd45ea Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
parent
0690c145db
commit
e2ff9e3b99
@ -17,6 +17,7 @@ macro.ouml.HTML = "ö"
|
|||||||
macro.QA = "\\e{Qt Assistant}"
|
macro.QA = "\\e{Qt Assistant}"
|
||||||
macro.QD = "\\e{Qt Designer}"
|
macro.QD = "\\e{Qt Designer}"
|
||||||
macro.QL = "\\e{Qt Linguist}"
|
macro.QL = "\\e{Qt Linguist}"
|
||||||
|
macro.Q_OBJECT = "Q_OBJECT"
|
||||||
macro.QQV = "\\e{Qt QML Viewer}"
|
macro.QQV = "\\e{Qt QML Viewer}"
|
||||||
macro.QtVersion = "$QT_VERSION"
|
macro.QtVersion = "$QT_VERSION"
|
||||||
macro.QtVer = "$QT_VER"
|
macro.QtVer = "$QT_VER"
|
||||||
|
@ -260,9 +260,6 @@ target_include_directories(Core_qobject PRIVATE
|
|||||||
target_link_libraries(Core_qobject PRIVATE Qt::Platform Qt::GlobalConfig)
|
target_link_libraries(Core_qobject PRIVATE Qt::Platform Qt::GlobalConfig)
|
||||||
target_link_libraries(Core PRIVATE Core_qobject)
|
target_link_libraries(Core PRIVATE Core_qobject)
|
||||||
|
|
||||||
# Comments trigger moc for these, so skip automoc:
|
|
||||||
set_source_files_properties(tools/qsharedpointer.cpp PROPERTIES SKIP_AUTOMOC ON)
|
|
||||||
|
|
||||||
set_property(TARGET Core APPEND PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig.h")
|
set_property(TARGET Core APPEND PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig.h")
|
||||||
set_property(TARGET Core APPEND PROPERTY PRIVATE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig_p.h")
|
set_property(TARGET Core APPEND PROPERTY PRIVATE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig_p.h")
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@
|
|||||||
\code
|
\code
|
||||||
class ScriptInterface : public QObject
|
class ScriptInterface : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
\Q_OBJECT
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
@ -233,15 +233,6 @@ add_qt_module(Gui
|
|||||||
Qt::Core
|
Qt::Core
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(
|
|
||||||
# Comment triggering moc:
|
|
||||||
opengl/qopenglfunctions.cpp
|
|
||||||
PROPERTIES
|
|
||||||
SKIP_AUTOMOC ON
|
|
||||||
SKIP_AUTOUIC ON
|
|
||||||
SKIP_AUTORCC ON)
|
|
||||||
|
|
||||||
|
|
||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void CLASS::init(QOpenGLContext *context) \
|
|||||||
\code
|
\code
|
||||||
class MyGLWindow : public QWindow, protected QOpenGLFunctions
|
class MyGLWindow : public QWindow, protected QOpenGLFunctions
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
\Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MyGLWindow(QScreen *screen = 0);
|
MyGLWindow(QScreen *screen = 0);
|
||||||
|
|
||||||
|
@ -58,14 +58,6 @@ add_qt_module(Network
|
|||||||
Qt::CorePrivate
|
Qt::CorePrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(
|
|
||||||
# Comment triggering moc:
|
|
||||||
access/qnetworkaccessdebugpipebackend_p.h
|
|
||||||
PROPERTIES
|
|
||||||
SKIP_AUTOMOC ON
|
|
||||||
SKIP_AUTOUIC ON
|
|
||||||
SKIP_AUTORCC ON)
|
|
||||||
|
|
||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
@ -31,12 +31,6 @@ add_qt_module(OpenGL
|
|||||||
Qt::GuiPrivate
|
Qt::GuiPrivate
|
||||||
Qt::WidgetsPrivate
|
Qt::WidgetsPrivate
|
||||||
)
|
)
|
||||||
set_source_files_properties(qglfunctions.cpp qgraphicsshadereffect.cpp PROPERTIES
|
|
||||||
SKIP_AUTOMOC ON
|
|
||||||
SKIP_AUTOUIC ON
|
|
||||||
SKIP_AUTORCC ON
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\code
|
\code
|
||||||
class MyGLWidget : public QGLWidget, protected QGLFunctions
|
class MyGLWidget : public QGLWidget, protected QGLFunctions
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
\Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}
|
MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\code
|
\code
|
||||||
class ColorizeEffect : public QGraphicsShaderEffect
|
class ColorizeEffect : public QGraphicsShaderEffect
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
\Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ColorizeEffect(QObject *parent = 0)
|
ColorizeEffect(QObject *parent = 0)
|
||||||
: QGraphicsShaderEffect(parent), color(Qt::black)
|
: QGraphicsShaderEffect(parent), color(Qt::black)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user