[Development] Controlling QML Imports

Alan Alpert 416365416c at gmail.com
Tue Dec 11 05:04:11 CET 2012

On Mon, Dec 10, 2012 at 7:43 PM, Lincoln Ramsay <a1291762 at gmail.com> wrote:
> On 11/12/12 13:23, Alan Alpert wrote:
>> Any comments on adding an API like this?
>> Are there any other usecases which this might need to support?
> If we're talking device security and restrictions policy... then please
> make this something that can fail "softly" at runtime.
> I know most mobile platforms seem intent on following the "app asks for
> permissions, user grants all or none" model but I'd like to think we'll
> be ready for the "app asks for permissions, user grants some of them"
> model if/when it arrives.
> Note though that this may be possible already, using
> Component.createObject() or Qt.createQmlObject(). As long as one of
> those can be used to "recover" from an import that fails due to this API
> (and as long as this method is documented) I'll be happy :)

You can pretty much do this already. If the import fails then the QML
file will fail to load, but you can split out the uncertain
functionality into another file and then dynamically load that file
(such as with Component.createObject()). Then the other file succeeds
or fails to load at runtime, and you can adapt appropriately.

Alan Alpert

More information about the Development mailing list