Solved Use of sub modules in Qt/QML
-
Hi,
I am trying to understand why in QML (and maybe in Qt too) you have sub modules.
For example, if you look at main.qml:import QtQuick 2.9 import QtQuick.Window 2.2
Why do you explicitly need to define QtQuick.Windows as well as you already defined QtQuick ealier? Does QtQuick on itself only loads parts of the QtQuick library?
What's the use?Thanks.
-
Please note that it is software architecture. Qt is well designed with plug-and-play concept. So different functionalities in QtQuick are provided in different modules. So it our interest to include module we require. If you don't want QtQuick.Window module don't include. It is flexibility given to us. Hence the different modules.
-
As though it might seem like that, the module
QtQuick
is not a superset containing things likeQtQuick.Window
. The same goes forQtQuick.Controls
etc. Think of them as "extensions" toQtQuick
rather than sub-modules. -
That's exactly what I thought: a superset. If you look at them like extensions it make sense indeed. Thanks!