Congratulations to our 2022 Qt Champions!

How to check in QML if plugin is available

  • Hi,

    I want to check from my QML application if the required plugin is available or not. so based on that i can have some conditional steps to do.

    Does anybody know how to do that ? is it possible in QML to check ?

    Thanks a lot :)

  • I'm not sure, but I don't think it is possible from QML. Maybe using C++ is a valid option for you?

  • Just try to load dummy qml file who has 'import yourplugin', if it's fails then plugin is unavailable.

    Never tried myself, it's a idea.

  • There isn't any official, built-in way to do this from QML in Qt Quick 1.x. It isn't especially elegant, but as minimoog77 suggested, a workaround is to use Loader or dynamic item creation to try and load a file with the needed import, and then check whether or not you've received any errors.

    Hopefully we'll have a better solution for this in a future version of QML.

Log in to reply