[Development] QML import versions

Mikko Harju mikko.harju at jolla.com
Mon Sep 21 13:51:10 CEST 2015


On 21.09.2015 00:51, Alan Alpert wrote:
> By using "import QtQuick 2.4" explicitly, that can't happen. That is
> the value offered by minor version numbers. It is the mechanism by
> which we achieve "Code written for older versions will Just Work on
> newer versions".

There is another side of the coin, too: code written for older versions
will not benefit from new features. In particular, consider the signal
once added to QQuickItem:

  Q_REVISION(1) void windowChanged(QQuickWindow* window);

Let's say an application uses 3rd party component import. When the
application developer needs the new signal, a workaround is needed until
the library bumps up its own imports:

 import TheirComponentLibrary 2.0
 import QtQuick 2.1

 TheirComponent {
   // onWindowChanged: bork() // TODO does not work since
   // TheirComponentLibrary has not bumped version for TheirComponent

   Item { // dummy workaround item
     onWindowChanged: bork()
   }
 }

Depending on the feature, workaround might or might not be possible. And
if it is not, the developer is at the mercy of the component release
schedule, or forced to re-invent.

At least there should be a way to force import versions process-wide to
certain value in order to test all dependencies with a new release.
Failing spectacularly in controlled environment would be a good feature
(detecting ambiguous names from non-namespaced imports, warnings from
accessing anything that has been tagged with revision X or above, etc).

Mikko










More information about the Development mailing list