[Interest] #define in qml
Bo Thorsen
bo at fioniasoftware.dk
Wed Feb 22 10:02:22 CET 2012
Den 21-02-2012 19:17, Thiago Macieira skrev:
> On terça-feira, 21 de fevereiro de 2012 22.16.09, Konstantin Tokarev wrote:
>> 21.02.2012, 22:09, "Thiago Macieira"<thiago at kde.org>:
>>> On terça-feira, 21 de fevereiro de 2012 18.06.37, qtnext wrote:
>>>> 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 !
>>>
>>> There's nothing we can do. The language simply doesn't support it.
>>
>> Wouldn't it be possible to enable simple version comparison like e.g.
>>
>> if (QtQuick.Version< 2) {
>> // some code
>> } else {
>> // other code
>> }
>>
>> ?
>
> That's already possible. But it doesn't help in any way because you can't have
> an import statement in "some code" there.
>
> You HAVE to write
> import QtQuick 1.1
> or
> import QtQuick 2.0
>
> without conditionals.
True. However, you kept writing that we have to load a QML file from C++
based on "some choice" if we support multiple versions. This test along
with a Loader object shows how you do this in javascript. I guess this
is only important if you have a project with only QML and JS files and
don't want to start up C++ files as well.
Maybe this was obvious, I just mention it for completion.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Interest
mailing list