Hi, On Wednesday 12 September 2012 19:16:29 Till Oliver Knoll wrote: > 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: > >> 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?!
No. It implies that with #include<QWidget> you get an outright compiler error when you miss QT+=widgets while the project can still be compiled with Qt4 where it would be #include<QtGui/QWidget>. > 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. Another technique that I use: To make the project link correctly to both Qt4 and Qt5 in the *.pro: contains(QT_MAJOR_VERSION,"5") { QT += widgets printsupport } And in the rare cases that APIs changed in *.cpp files: QString subject=mycert.subjectInfo(QSslCertificate::CommonName) #if QT_VERSION >= 0x50000 .value(0) #endif ; Konrad
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest