Resolving paths relative to the calling document prevents these problems.
well, I still am not convinced. In my non-plugin scenario, I had the components in a subdirectory. If I directly referenced the root component via directory import, it was found and all nested types as well. If I load the root component through a Loader, suddenly nested components are NOT found. Again:
main.qml
navigation
Reusable.qml <-- uses Nested
Nested.qml
main.qml
navigation
Reusable.qml <-- uses Nested
Nested.qml
To copy to clipboard, switch view to plain text mode
now, if in main.qml I simply do a directory import and use the Reusable type, everything works well:
import "navigation"
Rectangle {
Reusable {
}
}
import "navigation"
Rectangle {
Reusable {
}
}
To copy to clipboard, switch view to plain text mode
However, if I load Reusable dynamically
Rectanngle {
Loader {
source: "navigation/Reusable.qml"
}
}
Rectanngle {
Loader {
source: "navigation/Reusable.qml"
}
}
To copy to clipboard, switch view to plain text mode
I see an error message that file "navigation/Nested.qml" was not found. In a plugin scenario, the message simply says "Nested is not a type". If this makes sense somehow, it is still almost impossible IMO to find a smooth path from that message to a solution, which may mean that the concepts are not that clear and plausible, or at least not well explained. As I said, it took a day of desperate poking for me.
Bookmarks