Migration of QtMvvm from github
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

213 lines
16 KiB

<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtMvvm: injection.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="display: inline;">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">QtMvvm
&#160;<span id="projectnumber">1.1.0</span>
</div>
<div id="projectbrief">A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel</div>
</td>
</tr>
</tbody>
</table>
<a style="float: right;" target="_blank" href="https://github.com/Skycoder42/QtMvvm">
<img style="padding: 10px;" src="GitHub_Logo.png"/>
</a>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_8373e943c4cd41f1987d0cef0f366888.html">mvvmcore</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">injection.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A header with injection related code.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;qtmvvmcore_global.h&quot;</code><br />
</div>
<p><a href="injection_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespace_qt_mvvm"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_qt_mvvm.html">QtMvvm</a></td></tr>
<tr class="memdesc:namespace_qt_mvvm"><td class="mdescLeft">&#160;</td><td class="mdescRight">The primary namespace of the <a class="el" href="namespace_qt_mvvm.html" title="The primary namespace of the QtMvvm library. ">QtMvvm</a> library. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a0a6e278ad53a06df6f32b1b636ec6151"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="injection_8h.html#a0a6e278ad53a06df6f32b1b636ec6151">QTMVVM_INJECT</a>(classType, name)</td></tr>
<tr class="memdesc:a0a6e278ad53a06df6f32b1b636ec6151"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark a property for injection. <a href="#a0a6e278ad53a06df6f32b1b636ec6151">More...</a><br /></td></tr>
<tr class="separator:a0a6e278ad53a06df6f32b1b636ec6151"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6fae8ec64f64d9ef355df8d23d1daa6f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="injection_8h.html#a6fae8ec64f64d9ef355df8d23d1daa6f">QTMVVM_INJECT_PROP</a>(type, name, member)</td></tr>
<tr class="memdesc:a6fae8ec64f64d9ef355df8d23d1daa6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a for injection marked property based on a member. <a href="#a6fae8ec64f64d9ef355df8d23d1daa6f">More...</a><br /></td></tr>
<tr class="separator:a6fae8ec64f64d9ef355df8d23d1daa6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ada3398eab54e79982c27bb4b7d8e4b9f"><td class="memTemplParams" colspan="2"><a id="ada3398eab54e79982c27bb4b7d8e4b9f"></a>
template&lt;typename TInterface &gt; </td></tr>
<tr class="memitem:ada3398eab54e79982c27bb4b7d8e4b9f"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespace_qt_mvvm.html#ada3398eab54e79982c27bb4b7d8e4b9f">QtMvvm::registerInterfaceConverter</a> ()</td></tr>
<tr class="memdesc:ada3398eab54e79982c27bb4b7d8e4b9f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers <a class="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 <a class="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 class="separator:ada3398eab54e79982c27bb4b7d8e4b9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A header with injection related code. </p>
<p class="definition">Definition in file <a class="el" href="injection_8h_source.html">injection.h</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a0a6e278ad53a06df6f32b1b636ec6151"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0a6e278ad53a06df6f32b1b636ec6151">&#9670;&nbsp;</a></span>QTMVVM_INJECT</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define QTMVVM_INJECT</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">classType, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">name&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><span class="keyword">static</span> <span class="keyword">inline</span> <a class="codeRef" 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/qbytearray.html">QByteArray</a> __qtmvvm_inject_##name() { \</div><div class="line"> return QtMvvm::__helpertypes::inject_iid&lt;classType&gt;(); \</div><div class="line"> } \</div><div class="line"> Q_PROPERTY(<a class="codeRef" 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/qbytearray.html">QByteArray</a> __qtmvvm_inject_##name READ __qtmvvm_inject_##name STORED <span class="keyword">false</span> SCRIPTABLE <span class="keyword">false</span> DESIGNABLE <span class="keyword">false</span> CONSTANT FINAL)</div><div class="ttc" id="qbytearray_html"><div class="ttname"><a href="https://doc.qt.io/qt-5/qbytearray.html">QByteArray</a></div></div>
</div><!-- fragment -->
<p>Mark a property for injection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">classType</td><td>The type of the property to be injected </td></tr>
<tr><td class="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 <a class="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 <a class="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><div class="fragment"><div class="line"><span class="keyword">class </span>MyClass : <span class="keyword">public</span> <a class="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><div class="line">{</div><div class="line"> Q_OBJECT</div><div class="line"></div><div class="line"> Q_PROPERTY(IService* service READ service WRITE setService)</div><div class="line"> <a class="code" href="injection_8h.html#a0a6e278ad53a06df6f32b1b636ec6151">QTMVVM_INJECT</a>(IService*, service)</div><div class="line"></div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="comment">//...</span></div><div class="line">}</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>All properties that make use of interfaces must register the interfaces via <a class="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>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="injection_8h.html#a6fae8ec64f64d9ef355df8d23d1daa6f" title="Create a for injection marked property based on a member. ">QTMVVM_INJECT_PROP</a>, <a class="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>, <a class="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>
</div>
</div>
<a id="a6fae8ec64f64d9ef355df8d23d1daa6f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6fae8ec64f64d9ef355df8d23d1daa6f">&#9670;&nbsp;</a></span>QTMVVM_INJECT_PROP</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define QTMVVM_INJECT_PROP</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">type, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">name, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">member&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">Q_PROPERTY(type name MEMBER member) \</div><div class="line"> QTMVVM_INJECT(type, name)</div></div><!-- fragment -->
<p>Create a for injection marked property based on a member. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>The type of the property to be created </td></tr>
<tr><td class="paramname">name</td><td>The name of the property to be created </td></tr>
<tr><td class="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 <a class="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><div class="fragment"><div class="line"><span class="keyword">class </span>MyClass : <span class="keyword">public</span> <a class="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><div class="line">{</div><div class="line"> Q_OBJECT</div><div class="line"></div><div class="line"> <a class="code" href="injection_8h.html#a6fae8ec64f64d9ef355df8d23d1daa6f">QTMVVM_INJECT_PROP</a>(IService*, service, _service)</div><div class="line"></div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="comment">//...</span></div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"> IService* _service;</div><div class="line">}</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>All properties that make use of interfaces must register the interfaces via <a class="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>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="injection_8h.html#a0a6e278ad53a06df6f32b1b636ec6151" title="Mark a property for injection. ">QTMVVM_INJECT</a>, <a class="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>, <a class="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>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Aug 8 2018 19:15:45 for QtMvvm by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>