[Qt-creator] Testing of own plugin

Eike Ziller Eike.Ziller at qt.io
Fri Jan 27 15:23:47 CET 2023


It should work. The include must use the same name as the cpp file, with the .moc extension instead, e.g. "foo.moc" for "foo.cpp".
Maybe you need to explicitly run cmake after that...

Br, Eike

> Am 26/01/2023 um 15:32 schrieb Knut Petter Svendsen <knutpett+qtcreator at pvv.org>:
> 
> Caution: “This email is from outside The Qt Company and may contain potentially harmful links or attachments. To protect yourself and the company's network, please do not click on any links or open any attachments unless you have verified the sender and the email's authenticity.”
> 
> 
> 
>>> I've added a few dummy tests to my example dummy plugin, as a reference
>>> for (one way of solving) the details, that uses the fact that
>>> add_qtc_plugin etc does some helpful things when WITH_TESTS is set:
>>> 
>>> https://github.com/e4z9/qtcreator-testplugin/commit/fa8065f580ee5724f8b9afb06e904e1be1c2e343
>> 
> 
> I'm trying to do exactly the same as you with tst_mytest.cpp, but I must
> be missing something because I get
> AutoMoc error:
> --------------
> "SRC":.....
> contains a "Q_OBJECT" macro, but it does not include ".....moc"!
> ...
> 
> But I do #include that .moc file. How do I instruct cmake to moc that file?
> 
> Knut
> 



More information about the Qt-creator mailing list