<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi,</p>
<p><br>
</p>
<p>No objection per-se, but we'd have to figure out some details. For example declarative instantiation is</p>
<p>not an object, as the ownership rules do not comply with QObject. That would leave us with a JavaScript</p>
<p>constructor function, replacing Qt.point(...) for example. But then we'd have to comply with the namespace</p>
<p>rules, so we'd have</p>
<p><br>
</p>
<p>    qmlRegisterGadget<MyGadget>("MyModule", "ThatName", 1, 0);</p>
<p><br>
</p>
<p>and then</p>
<p><br>
</p>
<p>    import MyModule 1.0</p>
<p><br>
</p>
<p>and in expressions we'd have</p>
<p><br>
</p>
<p>    var g = new ThatName();</p>
<p><br>
</p>
<p>and the same for a namespaced import:</p>
<p><br>
</p>
<p>    import MyModule 1.0 as Foo</p>
<p><br>
</p>
<p>    var g = new Foo.ThatName();</p>
<p><br>
</p>
<p>It's a bit of work to do, but I don't see a problem in principle.</p>
<p><br>
</p>
<p>Simon</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Development <development-bounces+simon.hausmann=qt.io@qt-project.org> on behalf of BogDan Vatra <bogdan@kdab.com><br>
<b>Sent:</b> Tuesday, July 26, 2016 5:28:35 PM<br>
<b>To:</b> development@qt-project.org<br>
<b>Subject:</b> [Development] [QML]: Why can't create Q_GADGETs from QML ?</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi,<br>
<br>
Is there any reason why I can only use Q_GADGETs objects in QML, but not to <br>
create them?<br>
<br>
It will be nice if we can register Q_GADGETs  as qml creatable types too.<br>
<br>
Cheers,<br>
BogDan.<br>
_______________________________________________<br>
Development mailing list<br>
Development@qt-project.org<br>
<a href="http://lists.qt-project.org/mailman/listinfo/development">http://lists.qt-project.org/mailman/listinfo/development</a><br>
</div>
</span></font>
</body>
</html>