[Qt-qml] Qml Object static function
Bo Thorsen
bo at fioniasoftware.dk
Wed Dec 7 10:27:01 CET 2011
Den 07-12-2011 00:55, bea.lam at nokia.com skrev:
>
> On 06/12/2011, at 3:39 AM, ext Jesus Fernandez wrote:
>
>> Hi,
>>
>> Is there a way to have a Qml object with a function that doesn't require the object instantiation?
>> I want to create a Qml object with a show function to create Object dynamicly. The function behaviour will be like a object factory (Static class function)
You should take a look at the Loader element.
http://doc.qt.nokia.com/latest/qml-loader.html
You can also do this with a javascript function that uses Component.
> If you don't want a custom QML type to be instantiable, you can register it using the overloaded version of qmlRegisterType() that doesn't take any arguments
>
> See the discussion at http://lists.qt.nokia.com/pipermail/qt-qml/2010-October/001470.html
If this is what he wants, I'd go with registering a global object on the
context instead of this weird hack.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Qt-qml
mailing list