[Interest] #define in qml
Bo Thorsen
bo at fioniasoftware.dk
Mon Feb 20 09:15:37 CET 2012
Den 20-02-2012 08:53, Thiago Macieira skrev:
> On segunda-feira, 20 de fevereiro de 2012 08.23.26, Bo Thorsen wrote:
>> Den 19-02-2012 21:00, Thiago Macieira skrev:
>>> On domingo, 19 de fevereiro de 2012 20.41.56, qtnext wrote:
>>>> Hi,
>>>>
>>>> I wants to start testing my Qml apps (qt4.8, quick 1.1) with Quick2 Qt5
>>>> ... But how can I easily test it with Qt5 with a working Qt4 source ..
>>>> Is there any way to define #ifdef QT5 import Quick 2.0 #else import
>>>> Quick 1.1 ?
>>>
>>> That's not how you're supposed to do it.
>>>
>>> You're supposed to upgrade to Qt Quick 2.0 when you're ready to upgrade
>>> and
>>> never look back. Then you make sure it looks correct when you do.
>>
>> Which means it's quite difficult to create add-on products for QML that
>> supports multiple versions.
>
> Again, not the use-case. You don't support multiple versions of Qt Quick.
> Multiple versions of Qt Quick support you.
>
> If you import Qt Quick 1.1, it will be the same version of 1.1 with the same
> behaviour issues. If you don't change the import statement, the behaviour will
> not change, even if Qt is upgraded.
True, but if a QML library is put out, you want to support the features
of the later versions as well.
> 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.
>> I don't know how to solve this, though. Adding a preprocessor over QML
>> files just feels fundamentally wrong to me, but it might be the only
>> solution for a QML library vendor.
>
> I'm interested in what other problems you might have as a QML library vendor
> (not an application vendor).
I don't have one yet. I do have a set of QML files I'm thinking of
publishing, but if I do so it will probably just be on my Qt blog. Then
it's up to the users to modify for newer versions :)
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