[Development] [QML]: Why can't create Q_GADGETs from QML ?

BogDan Vatra bogdan at kdab.com
Thu Jul 28 10:08:28 CEST 2016


Hi,

Task created here https://bugreports.qt.io/browse/QTBUG-54983

Cheers,
BogDan.

On marți, 26 iulie 2016 15:37:04 EEST Simon Hausmann wrote:
> Hi,
> 
> 
> No objection per-se, but we'd have to figure out some details. For example
> declarative instantiation is
> 
> not an object, as the ownership rules do not comply with QObject. That would
> leave us with a JavaScript
> 
> constructor function, replacing Qt.point(...) for example. But then we'd
> have to comply with the namespace
> 
> rules, so we'd have
> 
> 
>     qmlRegisterGadget<MyGadget>("MyModule", "ThatName", 1, 0);
> 
> 
> and then
> 
> 
>     import MyModule 1.0
> 
> 
> and in expressions we'd have
> 
> 
>     var g = new ThatName();
> 
> 
> and the same for a namespaced import:
> 
> 
>     import MyModule 1.0 as Foo
> 
> 
>     var g = new Foo.ThatName();
> 
> 
> It's a bit of work to do, but I don't see a problem in principle.
> 
> 
> Simon
> 
> ________________________________
> From: Development <development-bounces+simon.hausmann=qt.io at qt-project.org>
> on behalf of BogDan Vatra <bogdan at kdab.com> Sent: Tuesday, July 26, 2016
> 5:28:35 PM
> To: development at qt-project.org
> Subject: [Development] [QML]: Why can't create Q_GADGETs from QML ?
> 
> Hi,
> 
> Is there any reason why I can only use Q_GADGETs objects in QML, but not to
> create them?
> 
> It will be nice if we can register Q_GADGETs  as qml creatable types too.
> 
> Cheers,
> BogDan.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development





More information about the Development mailing list