Don't forget in OOP, you can always provide an interface class with virtual 
functions, then use the build environment to select the proper implementation 
for inclusion. But this approach is limited, especially when you're trying to 
handle version differences in the toolkit.


I myself prefer to keep #defines and #ifdefs to a minimum, as it complicates 
testing code paths. Whereas a class will always have the same code path, and 
can be restricted by a pure virtual class. 





----- Original Message -----
From: qtnext <qtn...@gmail.com>
To: henry.haveri...@nokia.com
Cc: interest@qt-project.org
Sent: Tuesday, February 21, 2012 12:06 PM
Subject: Re: [Interest] #define in qml

it's sure that lot of people will wait for a release version of 5.0, or 
5.1, if there is no way to use the same source code with #ifdef ... 
Providing the way to test Qt5 before, will allow more feedback from 
users ... and a stronger release ! just my two cents !


Le 21/02/2012 17:55, henry.haveri...@nokia.com a écrit :
> On 2/20/12 10:47 AM, "ext Thiago Macieira"<thi...@kde.org>  wrote:
>
>>>> It's also possible to have different .qml files having slightly
>>> different
>>>> imports. You just can't mix major versions, because the backend
>>> library is
>>>> completely different.
>>> I would also assume that it's necessary to have separate files for each
>>> supported version. I can only speculate on how many there would be, but
>>> my guess would be not too many. So it might not be a problem. If there
>>> are a lot of them, it would become a maintainance nightmare.
>> Indeed, separate files. The point is that you should not have to keep
>> many
>> files. Once you're ready to upgrade (and require a new version), you do
>> it and
>> don't look back. You don't keep two versions working.
> Another common case for #ifdefs is configuration management in
> cross-platform projects.
> It's not always possible to port a project to a new platform and never
> look back. :-)
>
> In one of our Qt SDK user surveys, we asked how much people use non-Qt
> APIs in their projects.
> Only around 20-25% of projects were 100% Qt code, varying a bit between
> target platforms.
> Here are the results for one random platform, Mac OS X (N = 287):
>
> My application is 100% Qt Code: 20.6 %
>
> Small part of my application uses non­-Qt APIs: 54.0 %
>
> Significant part of my application uses non-Qt APIs: 17.1 %
> I use Qt for a small part of my application only: 3.8 %
>
>
> I know this data doesn't prove that #ifdefs are required, because maybe
> some of the non-Qt APIs might be cross-platform, and maybe some of the
> code that calls non-Qt non-cross-platform APIs can be separated out in
> platform-specific source files. Anyways, cross-platform Qt C++ projects
> often benefit from being able to have #ifdefs around some short snippets
> inside a file.
>
> I would expect some sort of conditional evaluation statement would be
> useful in cross-platform Qt Quick projects too.
>
> Cheers,
> Henry
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to