Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

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.


  • Qt Champions 2017

    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 like QtQuick.Window. The same goes for QtQuick.Controls etc. Think of them as "extensions" to QtQuick rather than sub-modules.



  • That's exactly what I thought: a superset. If you look at them like extensions it make sense indeed. Thanks!


Log in to reply