21
votes

Usually my QML files start with import QtQuick 2.4 and other imports. How can I know which is the latest version of the imported modules without having to guess by type and build?

1
Read the release notes.dtech
I guess the real question is: why do you think that you need to know it, since most likely it's for the wrong reasons...Kuba hasn't forgotten Monica
I think this is a very good question, and it's been brought up before. There's been talk of adding the ability to leave off the version number on imports and have it import the latest version, which I think is a great idea. Having to go to the documentation to see which version to import when it almost always doesn't matter is annoying.Mitch
QTBUG-38304 has this suggestion, although it's a bit drawn out and would be a better suggestion if it was just "QQmlEngine should import the latest available version of a module if the version number is omitted".Mitch

1 Answers

12
votes

You basically don't have to know. By importing a particular version, you merely declare that you don't need the additional functionality of any potentially newer version. That doesn't mean that you won't use a newer version if one is available - it simply means that your code will refuse to run if only an older version than the one you need is present.

So, you should only change the imported module version if you happen to use the functionality (members, classes, etc.) from a newer version. That's all. And you will know exactly what version you need, since you're using the functionality you read about in the documentation. The documentation will state what module version it applies to.

The documentation for a given Qt Quick module from the Qt that you're using will state this - no need for release notes.