On Thu, Nov 8, 2012 at 2:19 PM, Thiago Macieira <[email protected]> wrote: > On quinta-feira, 8 de novembro de 2012 09.57.05, Alan Alpert wrote: >> qmlRegisterType(const char* url, const char *uri, int versionMajor, >> int versionMinor, const char *qmlName). > [...] > >> This would allow for a platform component import which looks like this: >> if(platform=="desktoplinux") >> qmlRegisterType("/usr/share/desktop/components/Button.qml", uri, >> 2, 0, "Button"); >> else if (platform=="meego") >> qmlRegisterType("/usr/share/meego/components/Button.qml", uri, 2, >> 0, "Button"); > > Please be careful with your uses of URL. You named the parameter "url" but > then you passed what looks like a path name. It's definitely not an absolute > URL, but it could be a relative one. > > If the API accepts a relative URL, you need to define what it's relative to. > For example, it's relative to the $PWD at the time of the invocation of the > function. Or, another suggestion, is that it's relative to $PWD at the moment > of use. > > My recommendation is that you do not allow relative URLs. Require them to be > absolute, in which case you'll need the "file:///" prefix.
The original thought was that the URL/path should be resolved the same as the URLs given to QQmlComponent or QQuickView. This means it would be relative to $PWD at the time the QUrl is constructed - I should probably change the type to QUrl then :) . -- Alan Alpert _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
