someclass.h, someclass_alternative.cpp and auto moc

Milian Wolff mail at milianw.de
Thu Oct 19 12:03:16 UTC 2017


On Dienstag, 10. Oktober 2017 01:56:54 CEST René J.V. Bertin wrote:
> Hi,
> 
> Apologies for asking something that should probably be evident (I can't come
> up with a specific enough google search term).
> 
> I'm still polishing my QTextBrowser implementation for
> StandardDocumentationView and thought it would be cleaner if I put it in a
> dedicated implementation file standarddocumentation_qtb.cpp. Evidently I
> need to keep the standarddocumentationview.h headerfile. Then in the CMake
> file I'd do
> 
> if(KDEVELOP_USE_QTEXTBROWSER)
>     set(KDevPlatformDocumentation_LIB_SRCS
>         standarddocumentationview_qtb.cpp)
> else()
>     set(KDevPlatformDocumentation_LIB_SRCS
>         standarddocumentationview.cpp)
> endif()
> set(KDevPlatformDocumentation_LIB_SRCS ${KDevPlatformDocumentation_LIB_SRCS}
> documentationfindwidget.cpp
>     documentationview.cpp
> )
> 
> 
> Sadly I get a number of link errors that show that something goes wrong with
> the moc file, unless I keep standarddocumentationview.cpp included with all
> code #ifdef'ed out and just a moc file include.
> 
> That's better than nothing but is there no more elegant way to do what I'm
> trying to do here?

Are you maybe missing the explicit moc include?

#include "standarddocumentationview_qtb.moc"

or was it

#include "moc_standarddocumentationview_qtb.cpp"

?

Google and test those, maybe it helps.

But in principle, I would claim that this pattern above isn't nice in the 
first place. Rather, have the standarddocumentationview.h include either the 
_qtb or the _web.h, and then have accompanying .cpp files for those headers. 
That should fix it.


-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20171019/37246698/attachment.sig>


More information about the KDevelop-devel mailing list