<trclass="memdesc:namespace_qt_mvvm"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The primary namespace of the <aclass="el"href="namespace_qt_mvvm.html"title="The primary namespace of the QtMvvm library. ">QtMvvm</a> library. <br/></td></tr>
<trclass="memdesc:a0a6e278ad53a06df6f32b1b636ec6151"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Mark a property for injection. <ahref="#a0a6e278ad53a06df6f32b1b636ec6151">More...</a><br/></td></tr>
<trclass="memdesc:a6fae8ec64f64d9ef355df8d23d1daa6f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create a for injection marked property based on a member. <ahref="#a6fae8ec64f64d9ef355df8d23d1daa6f">More...</a><br/></td></tr>
<trclass="memdesc:ada3398eab54e79982c27bb4b7d8e4b9f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Registers <aclass="elRef"target="_blank"doxygen="/home/sky/Qt/Docs/Qt-5.11.1/qtcore/qtcore.tags:https://doc.qt.io/qt-5/"href="https://doc.qt.io/qt-5/qvariant.html">QVariant</a> converters from <aclass="elRef"target="_blank"doxygen="/home/sky/Qt/Docs/Qt-5.11.1/qtautoupdater/qtautoupdater.tags:https://doc.qt.io/qt-5/"href="https://doc.qt.io/qt-5/class_q_object.html">QObject</a> to an interface type registered with Q_DECLARE_INTERFACE. <br/></td></tr>
<tr><tdclass="paramname">classType</td><td>The type of the property to be injected </td></tr>
<tr><tdclass="paramname">name</td><td>The name of the property to be injected</td></tr>
</table>
</dd>
</dl>
<p>This macro creates an additional property that is detected by the <aclass="el"href="class_qt_mvvm_1_1_service_registry.html"title="A singleton to prepare services for dependency injection and to access them. ">QtMvvm::ServiceRegistry</a> and contains the information needed to inject the property automatically. For more details on the property injection, see <aclass="el"href="class_qt_mvvm_1_1_service_registry.html"title="A singleton to prepare services for dependency injection and to access them. ">QtMvvm::ServiceRegistry</a></p>
<p>Sample code for usage: </p><divclass="fragment"><divclass="line"><spanclass="keyword">class </span>MyClass : <spanclass="keyword">public</span><aclass="codeRef"target="_blank"doxygen="/home/sky/Qt/Docs/Qt-5.11.1/qtautoupdater/qtautoupdater.tags:https://doc.qt.io/qt-5/"href="https://doc.qt.io/qt-5/class_q_object.html">QObject</a></div><divclass="line">{</div><divclass="line"> Q_OBJECT</div><divclass="line"></div><divclass="line"> Q_PROPERTY(IService* service READ service WRITE setService)</div><divclass="line"><aclass="code"href="injection_8h.html#a0a6e278ad53a06df6f32b1b636ec6151">QTMVVM_INJECT</a>(IService*, service)</div><divclass="line"></div><divclass="line"><spanclass="keyword">public</span>:</div><divclass="line"><spanclass="comment">//...</span></div><divclass="line">}</div></div><!-- fragment --><dlclass="section note"><dt>Note</dt><dd>All properties that make use of interfaces must register the interfaces via <aclass="el"href="namespace_qt_mvvm.html#ada3398eab54e79982c27bb4b7d8e4b9f"title="Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE. ">QtMvvm::registerInterfaceConverter</a></dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="injection_8h.html#a6fae8ec64f64d9ef355df8d23d1daa6f"title="Create a for injection marked property based on a member. ">QTMVVM_INJECT_PROP</a>, <aclass="el"href="namespace_qt_mvvm.html#ada3398eab54e79982c27bb4b7d8e4b9f"title="Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE. ">QtMvvm::registerInterfaceConverter</a>, <aclass="el"href="class_qt_mvvm_1_1_service_registry.html"title="A singleton to prepare services for dependency injection and to access them. ">QtMvvm::ServiceRegistry</a></dd></dl>
<b>Value:</b><divclass="fragment"><divclass="line">Q_PROPERTY(type name MEMBER member) \</div><divclass="line"> QTMVVM_INJECT(type, name)</div></div><!-- fragment -->
<p>Create a for injection marked property based on a member. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">type</td><td>The type of the property to be created </td></tr>
<tr><tdclass="paramname">name</td><td>The name of the property to be created </td></tr>
<tr><tdclass="paramname">member</td><td>The name of the member variable to use for the property</td></tr>
</table>
</dd>
</dl>
<p>This macro is a shortcut for <aclass="el"href="injection_8h.html#a0a6e278ad53a06df6f32b1b636ec6151"title="Mark a property for injection. ">QTMVVM_INJECT</a> to create a property and mark it for injection in one step. The property is created by using a member variable. This means it will have no public member functions to access the property, only the property accessors itself.</p>
<p>Sample code for usage: </p><divclass="fragment"><divclass="line"><spanclass="keyword">class </span>MyClass : <spanclass="keyword">public</span><aclass="codeRef"target="_blank"doxygen="/home/sky/Qt/Docs/Qt-5.11.1/qtautoupdater/qtautoupdater.tags:https://doc.qt.io/qt-5/"href="https://doc.qt.io/qt-5/class_q_object.html">QObject</a></div><divclass="line">{</div><divclass="line"> Q_OBJECT</div><divclass="line"></div><divclass="line"><aclass="code"href="injection_8h.html#a6fae8ec64f64d9ef355df8d23d1daa6f">QTMVVM_INJECT_PROP</a>(IService*, service, _service)</div><divclass="line"></div><divclass="line"><spanclass="keyword">public</span>:</div><divclass="line"><spanclass="comment">//...</span></div><divclass="line"></div><divclass="line"><spanclass="keyword">private</span>:</div><divclass="line"> IService* _service;</div><divclass="line">}</div></div><!-- fragment --><dlclass="section note"><dt>Note</dt><dd>All properties that make use of interfaces must register the interfaces via <aclass="el"href="namespace_qt_mvvm.html#ada3398eab54e79982c27bb4b7d8e4b9f"title="Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE. ">QtMvvm::registerInterfaceConverter</a></dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="injection_8h.html#a0a6e278ad53a06df6f32b1b636ec6151"title="Mark a property for injection. ">QTMVVM_INJECT</a>, <aclass="el"href="namespace_qt_mvvm.html#ada3398eab54e79982c27bb4b7d8e4b9f"title="Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE. ">QtMvvm::registerInterfaceConverter</a>, <aclass="el"href="class_qt_mvvm_1_1_service_registry.html"title="A singleton to prepare services for dependency injection and to access them. ">QtMvvm::ServiceRegistry</a></dd></dl>