[Development] QML import versions

André Somers andre at familiesomers.nl
Mon Sep 21 13:23:38 CEST 2015


Op 21-9-2015 om 13:08 schreef Filippo Cucchetto:
> I agree with most of what has been said by everyone here.
> What i see it's there're two problems:
> 1) A way to specify a QML module version based on a Qt release
> 2) A way to decentralize the version used in several .qml files or of 
> an entire project
> To me we should focus on (1) since (2) could be solved later and we 
> can get support
> from an IDE refactoring tool (i'm thinking of a QtCreator refactor 
> action).
> Furthermore the (2) should not disable the ability of a dev to import 
> a specific version
> in a single file (so overriding a global setting).
>
> For (1) i like what has been proposed by Alan so
> import QtQuick from Qt 5.5
> feels nice to me
>
> For (2) i agree with Simon in creating a custom file with some format 
> for specifing
> the import version. Thus allowing a dev to just write
> import QtQuick
>
> At the end someone could also argue that we could provide custom files 
> (2) for each Qt
> release and so (1) could be skipped.
> The user just need to copy one of this files to its own project dir 
> and be done.

Would it be feasible to have such files be selectable based on the name, 
so the "Qt 5.5" would simply point to a file?
What constitutes 5.5 could be defined in such a file, and the fact that 
you use the 'from' keyword points to a specific file called "Qt 5.5" 
with some extension. If you don't specify "from", the engine could use 
the first it finds, starting from the project dir or somethingn like 
that (or the one specified in an environment variable or on the command 
line?).

The user could also make his own (named) configuration files, and use 
them like this:
import QtQuick from MyProjectConfig 1

That way, you would not need separate mechanisms or any copying of 
configuration files, unless you want to use some Qt config as the 
starting point of your own config.

> Supposing to name the file "MyCustomConf.qmlversion" the content could 
> be something like
> this (and maybe with a qml syntax)
> import QtVersion 1.0
> Modules {
>    Module { name: "QtQuick"; version: "2.5" }
>    Module { name: "QtQuick.Controls"; version: "1.4" }
>    ...
>    Module { name: "QtQuick.Layouts"; version: QtVersion.since(Qt.55) }
> }
>

André




More information about the Development mailing list