Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QML import statement: why specify module version?

I know what version of Qt I'm shipping my app with. And I suppose a single version of Qt contains only a single version of each QML module. So if I were to write:

import QtQuick

(no version specified), that would be unambiguous. So why is it necessary to specify the module version?

like image 248
Stefan Monov Avatar asked Oct 30 '22 21:10

Stefan Monov


1 Answers

It is, so everyone can see, which version is demanded.

It might be that you ship your code, using features of QtQuick 2.7, someone tries to open it with an older version (say: QtQuick 2.5) and strangely - it's broken.
If you import a specific version, it is clear, that the error stems from an too old version.

I think it is the best to always try to use the least version. So unless you use features of QtQuick 2.7, declare the older ones, to maximize compatibility.

like image 178
derM Avatar answered Nov 15 '22 05:11

derM