[Interest] My experience porting to Qt5 (on OS X)

Stephen Kelly stephen.kelly at kdab.com
Wed Sep 12 22:57:01 CEST 2012


On Wednesday, September 12, 2012 19:16:29 Till Oliver Knoll wrote:
> In fact, that is exactly the reason why I thought 'module includes' are such
> a great idea, as to not to forget to write
> 
>   QT += widgets
> 
> Besides, they force me to think twice whether the #include is at the proper
> place (e.g. I would like not to introduce dependencies on any GUI or
> widgets in my "model.dll").

Then simply don't use QT += widgets in model.pro. If you accidentally include 
<QWidgets/QAction> in a public header of model.dll, you *are* introducing 
widgets as a dependency of model.dll for downstreams. If I don't install 
QtWidgets, the header won't be there, and I can't use model.dll. 

Your build tools don't tell you that there is a problem. It compiles just fine 
(for you), even though the include should not be there. If you instead include 
<QAction>, your compiler will not find that header and you will immediately 
know you made a mistake.

Thanks,

-- 
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120912/1965b917/attachment.sig>


More information about the Interest mailing list