[Development] Another method of registering QML types

Shawn Rutledge shawn.rutledge at digia.com
Thu Nov 8 19:23:37 CET 2012


On Thu, Nov 08, 2012 at 07:14:52PM +0100, Olivier Goffart wrote:
> On Thursday 08 November 2012 09:57:05 Alan Alpert wrote:
> > Currently, there is no way to register QML files as types from C++.
> > This is the exact same functionality that qmldir provides, but I think
> > there are situations where you'll want to do this progamatically
> > instead of with a qmldir file. There is a very specific example I have
> > in mind: Platform Components.
> > 
> > I'm suggesting another qmlRegisterTypes function, one that takes a URL
> > instead of a C++ type:
> > 
> > qmlRegisterType(const char* url, const char *uri, int versionMajor,
> > int versionMinor, const char *qmlName).
> 
> Paths should be QString.
> We support unicode paths.

const char* doesn't preclude UTF-8, whereas QStrings have to be
explicitly constructed nowadays.  That is annoying in many other contexts; 
I don't quite understand why we didn't just change the assumption from Latin1 
to UTF-8 and keep the transparent conversion working the way it used to.




More information about the Development mailing list