Am 12.09.2012 um 17:47 schrieb Stephen Kelly <stephen.ke...@kdab.com>:
> On Wednesday, September 12, 2012 16:20:01 Nikos Chantziaras wrote: >> On 02/09/12 14:38, Till Oliver Knoll wrote: >>> The effor was indeed very painless: in my case I mainly had to adjust a >>> few #include (<QtGui/Whatever> -> <QtWidgets/Whatever>) and change >>> QDir::convertSeparators to QDir::toNativeSeparators. >> >> Note that if you just do: >> >> #include <Whatever> >> >> then you can build with both Qt4 and Qt5. > > If you do this, you also avoid mysterious linking errors resulting from > #include <QtWidgets/QWidget> Uhm... are you implying that when I #include <QWidget> that qmake automagically figures out that it needs to link with "qtwidgets.dll" (or whatever the name), even I /don't/ have QT += widgets? Whereas when I #include <QtWidgets/QWidget> it doesn't?! > without QT += widgets. I'd expect that either way (with and without the module name in the include) I /have/ to say QT += widgets in the *.pro file. Assuming off course that 'widgets' is not linked with by default (as is the case wit 'core' and 'gui' - at least in Qt4). And so far I /never/ had "mysterious linking errors" - ever. > That's why 'module includes' are a bad idea. 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"). So can you elaborate on what you mean by "mysterious linking errors"? As for the "compile with Qt 4/5" part: I simply created a "qt5" Git branch. Once everything is stable there I merge everything back to "master". Works like a charm. Cheers, Oliver _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest