Important: Please read the Qt Code of Conduct -

Qt.resolvedUrl() - What is the magic inside?

  • Hello everyone!
    I'd like to know how this method Qt.resolvedUrl() works. Moreover I'd like to recreate it on the C++ side.
    Why? Let me explain. I'm implementing my own internationalization system.
    I have a lot of folder-based qml components.
    Every time I write something like this source: MyObject.localizedUrl("image.svg") I'd like to implicitly pass a component url to my localizedUrl() method.
    What for? I have to check the existence of my localized files. For example: "image_en.svg", "image_de.svg", "image_fi.svg", etc.
    Certainly I can write source: MyObject.localizedUrl(Qt.resolvedUrl("image.svg")) but I'm looking for more elegant solution.
    Thank you in advance!

  • Hi! resolvedUrl is declared in qqmlcontext.h, the definition is here: qqmlcontext.cpp#n419.

Log in to reply