[Development] Convenience Imports in QML

Alan Alpert 416365416c at gmail.com
Wed Dec 12 22:12:47 CET 2012

On Wed, Dec 12, 2012 at 10:57 AM, André Pönitz
<andre.poenitz at mathematik.tu-chemnitz.de> wrote:
> On Wed, Dec 12, 2012 at 10:33:06AM +1000, Lincoln Ramsay wrote:
>> On 12/12/12 07:28, André Pönitz wrote:
>> > What about something like
>> >
>> >   import QtQml from Qt 5.0
>> >   import QtQuick from Qt 5.0
>> +1
> Thanks ;-)
>> All the benefits of "a group of QML modules attached to a single Qt
>> release" without the performance problem of pulling them all in.
>> Then "Qt 5.0" is just some meta-thing (possibly just a qmldir file) that
>> lists the modules/versions it contains.
> I actually think it's still to specfic. Upgrading from Qt 5.0 to 5.1
> would need touching all source files. So
>    import QtQml from TheQtIUse
>    import QtQuick from TheQtIUse
> and some one-liner somewhere that relates "TheQtIUse" with "Qt 5.0",
> perhaps even through the build system should be even better.

Hmm... so you're suggesting that we tie the imports for a single
application into a single file (manageable by the build system)? That
might work...

So all the application source files would look like this:

import QtQml from MyImports
import QtQuick from MyImports

There would be one file somewhere (MyImports.qmlimports?) containing this:
import QtQml 2.0
import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Particles 2.0
import QtAudioEngine 1.0
import QtMultimedia 5.0
import QtWebkit 3.0

which creator would automatically generate for a new Qt 5.0.0
application and which is deployed with the application.

Then the engine resolves it entirely from deployed files, and sees (effectively)
import QtQml 2.0
import QtQuick 2.0

in each file, maintaining the existing versioned import behaviour
(just a lot easier for developers).

Is this what you're suggesting?

Alan Alpert

More information about the Development mailing list