Hi,

1)     Add your header file to MOC_H_FILES in files.cmake (double-check, 
case-sensitivity, path, everything correct?)

2)     Derive from a QWidget or a subclass of it

3)     Make sure that the Qt base class that you derive from is the FIRST base 
class you write in your declaration like "class TestWidget : public QWidget, 
OtherBaseClass"

4)     Add Q_OBJECT to the class declaration

5)     Rerun CMake Generate before building your app

Best,
Stefan

PS: We recommend to work with Qt 5.12.x LTS.

From: p...@zjut.edu.cn [mailto:p...@zjut.edu.cn]
Sent: Friday, August 7, 2020 9:44 AM
To: mitk-users@lists.sourceforge.net
Subject: [mitk-users] Support Qt MetaObject in MITK project

Hi all,

I'm new to MITK and want to develop an application using MITK as a toolkit and 
Qt as the GUI.
It seems that the Step 6 in the tutorial fits my requirement best. The moc 
system processes Step6.h file with a Q_OBJECT successfully and generates a 
moc_Step6.cpp file. But when I add my own widgets (TestWidget.cpp and 
TestWidget.h, with Q_OBJECT in TestWidget.h), I can't get the 
moc_TestWidget.cpp. I notice that the files.cmake in 
MITK\Examples\Tutorial\Step6 folder includes the moc file list. So I add my own 
file to the list but still cannot get what I want.

Can anyone give me a hint?
Thanks!

Environment:
Win 10 64bit
MITK 2018.04
Qt 5.14.2
Visual Studio 2017

Dr. Qing PAN
Associate Professor
College of Information Engineering
Zhejiang University of Technology
288 Liuhe Road, 310023 Hangzhou China
Phone: +86-85290595
Email: p...@zjut.edu.cn<mailto:p...@zjut.edu.cn>

_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to