Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
Importing components
A component definition can be used directly by other QML files residing in the same directory as the component definition. In our example, the main.qml and Button.qml files are located in the same directory, so you can use the Button QML type inside main.qml without having to import anything.
If you need to access a component definition from a file residing elsewhere, you will have to first import the module containing the component in the file where you want to use it. The definition of a module is very simple—it is just a relative path to the directory containing QML files. This means that if you have a file named Baz.qml in a directory called Base/Foo/Bar and you want to use the Baz component from within the Base/Foo/Ham.qml ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access