-
Notifications
You must be signed in to change notification settings - Fork 515
COMP: Add AUTO(MOC|UIC|RCC) build. Add missing Q_OBJECT for decendants of QObject #1239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jcfr I am working through the 'clazy' qt5->qt6 preparation recommendations. I was hoping that this could be two separate PR's, but after a few hours trying to separate them, I gave up. |
ff6a9dd to
8dfa920
Compare
7f61cb0 to
88fde4f
Compare
Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerShowXmlAction.h
Outdated
Show resolved
Hide resolved
0ff3b60 to
fcbaed2
Compare
fcbaed2 to
b410652
Compare
|
Build issues missed because BUILD_TESTING was off. Need to fix the code that is exercised by tests the same way other fixes were done. |
07f8a1b to
3fbd3cc
Compare
|
@jcfr Some next steps for CTK in preparation for Qt6. These are some of the fixes to address issues identified by export CLAZY_CHECKS="qt6-deprecated-api-fixes,qt6-header-fixes,qt6-qhash-signature,qt6-fwd-fixes,missing-qobject-macro"
export CLAZY_EXPORT_FIXES=ON
export CMAKE_EXPORT_COMPILE_COMMANDS=ON
export CMAKE_GENERATOR=Ninja
# use clazy as your compiler
#
cmake -GNinja -S Slicer -B clazySlicer-build -DCMAKE_CXX_COMPILER=clazy
cd clazySlicer-build
cmake --build . |
c45e8de to
49aa264
Compare
|
This depends upon fixing the duplicate symbols associated with PR #1244. Ths PR does not link correctly without PR#1244. |
1afe9d2 to
8adbb71
Compare
The same class is duplicated in two .cpp files. Duplicate symbols were created. Renamed the Widget dialog to be unique `ctkDICOMMetadataDialog` to `ctkDICOMWidgetMetadataDialog`
Ensure QObject-derived classes properly use the `Q_OBJECT` macro for meta-object functionality and include corresponding `.moc` files to support Qt's meta-object compiler. Add missing Q_OBJECT to complete Qt inheritance The Q_OBJECT macro is mandatory for any class that: • Inherits from QObject • Uses signals or slots • Declares properties (Q_PROPERTY) • Needs qobject_cast, metaObject(), or other Qt RTTI features Without it: • Qt’s meta-object compiler (moc) won’t generate necessary code • You may encounter runtime errors or silently broken signals/slots • Clazy and Qt's build system may warn or fail Need to include full class definitions instead of forward definitions. Replace forward declarations that were common in Qt 5, but are now discouraged in Qt 6. Full declarations are required when the Q_OBJECT macro is included as recommended to respect the Qt inheritance expectations.
Added `${CMAKE_CURRENT_SOURCE_DIR}/Libs/QtTesting` and
`${CMAKE_CURRENT_BINARY_DIR}/Libs/QtTesting` to include directories
to ensure proper visibility of QtTesting headers.
The AUTO* cmake support removes Qt5 specific wrapping
mechanisms that would be different in Qt6. Qt6 has
more strict dependance on full class type definitions
that are more easily managed with the AUTO* cmake
builds.
Define UIC search paths in CMake configuration
Simplify and modernize Qt build system integration
Refactor CMake scripts to utilize Qt auto-tools (AUTOMOC, AUTOUIC,
AUTORCC) where applicable, streamline resource and UI handling, and
add support for Qt6. Remove deprecated functions and conditional
processing for obsolete Qt5 versions.
NOTE: This creates a build error that is fixed in the next commit.
```txt
error: incomplete type 'ctkDICOMSchedulerPrivate' named
in nested name specifier
```
Remove unnecessary manual wrapping
AUTO* cmake tools preform the wrapping behaviors in the background.
Remove manual wrapping elements.
dd13cea to
8a9a958
Compare
|
@pieper Would you mind having another look at this PR? |
|
This pull request is superseded by the following pull request in which only the minimum required changes have been integrated: |
The AUTO* cmake support removes Qt5 specific wrapping
mechanisms that would be different in Qt6. Qt6 has
more strict dependence on full class type definitions
that are more easily managed with the AUTO* cmake
builds.
Add
Q_OBJECTmacro to relevant classes and include.mocfilesEnsure QObject-derived classes properly use the
Q_OBJECTmacro formeta-object functionality and include corresponding
.mocfiles tosupport Qt's meta-object compiler.
Add missing Q_OBJECT to complete Qt inheritance
The Q_OBJECT macro is mandatory for any class that:
• Inherits from QObject
• Uses signals or slots
• Declares properties (Q_PROPERTY)
• Needs qobject_cast, metaObject(), or other Qt RTTI features
Without it:
• Qt’s meta-object compiler (moc) won’t generate necessary code
• You may encounter runtime errors or silently broken signals/slots
• Clazy and Qt's build system may warn or fail
Need to include full class definitions instead of forward definitions.
Replace forward declarations that were common in Qt 5, but are now
discouraged in Qt 6.
Full declarations are required when the Q_OBJECT macro
is included as recommended to respect the Qt inheritance
expectations.