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.
257 lines
17 KiB
257 lines
17 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: QtMvvm::IPresenter Class 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
|
|
 <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&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&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="namespace_qt_mvvm.html">QtMvvm</a></li><li class="navelem"><a class="el" href="class_qt_mvvm_1_1_i_presenter.html">IPresenter</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="class_qt_mvvm_1_1_i_presenter-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">QtMvvm::IPresenter Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>The interface for a GUI view presenter.
|
|
<a href="class_qt_mvvm_1_1_i_presenter.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="ipresenter_8h_source.html">ipresenter.h</a>></code></p>
|
|
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
|
|
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for QtMvvm::IPresenter:</div>
|
|
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
|
|
</div>
|
|
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
|
|
<div class="center">
|
|
<img src="class_qt_mvvm_1_1_i_presenter.png" usemap="#QtMvvm::IPresenter_map" alt=""/>
|
|
<map id="QtMvvm::IPresenter_map" name="QtMvvm::IPresenter_map">
|
|
<area href="class_qt_mvvm_1_1_quick_presenter.html" title="The IPresenter implementation for the quick module. " alt="QtMvvm::QuickPresenter" shape="rect" coords="0,56,164,80"/>
|
|
<area href="class_qt_mvvm_1_1_widgets_presenter.html" title="The IPresenter implementation for the widgets module. " alt="QtMvvm::WidgetsPresenter" shape="rect" coords="174,56,338,80"/>
|
|
</map>
|
|
</div></div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a6bf902cf14d45c44fdcf78743d4e71a7"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qt_mvvm_1_1_i_presenter.html#a6bf902cf14d45c44fdcf78743d4e71a7">present</a> (<a class="el" href="class_qt_mvvm_1_1_view_model.html">ViewModel</a> *viewModel, const QVariantHash &params, <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/qpointer.html">QPointer</a>< <a class="el" href="class_qt_mvvm_1_1_view_model.html">ViewModel</a> > parent=nullptr)=0</td></tr>
|
|
<tr class="memdesc:a6bf902cf14d45c44fdcf78743d4e71a7"><td class="mdescLeft"> </td><td class="mdescRight">Called to present a viewmodel. <a href="#a6bf902cf14d45c44fdcf78743d4e71a7">More...</a><br /></td></tr>
|
|
<tr class="separator:a6bf902cf14d45c44fdcf78743d4e71a7"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a6e2921a23d4a8513a80526141f79b4d1"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qt_mvvm_1_1_i_presenter.html#a6e2921a23d4a8513a80526141f79b4d1">showDialog</a> (const <a class="el" href="class_qt_mvvm_1_1_message_config.html">MessageConfig</a> &config, <a class="el" href="class_qt_mvvm_1_1_message_result.html">MessageResult</a> *result)=0</td></tr>
|
|
<tr class="memdesc:a6e2921a23d4a8513a80526141f79b4d1"><td class="mdescLeft"> </td><td class="mdescRight">Called to present a dialog via a message config. <a href="#a6e2921a23d4a8513a80526141f79b4d1">More...</a><br /></td></tr>
|
|
<tr class="separator:a6e2921a23d4a8513a80526141f79b4d1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>The interface for a GUI view presenter. </p>
|
|
<p>This class is what you need to implement if you want to create your own GUI frontend for mvvm. Once you created your custom presenter class, register it as service before calling <a class="el" href="class_qt_mvvm_1_1_core_app.html#afb4cd9046e73ed2bca0884c7d0032470" title="Boots up the app and starts the mvvm presenting. ">CoreApp::bootApp()</a> (Or entering the eventloop, in case of automatic startup, like with <a class="el" href="coreapp_8h.html#aab7ff1f0090a9c98ecb7863f0d4c8af5" title="Registers you custom CoreApp class as CoreApp to be used. ">QTMVVM_REGISTER_CORE_APP</a>)</p>
|
|
<p>To register it, it is recommended to use a startup hook like this: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> myPresenterInit()</div><div class="line">{</div><div class="line"> <a class="code" href="class_qt_mvvm_1_1_service_registry.html#aabda69c79dc04cebfd2ebaea25e9ee62">QtMvvm::ServiceRegistry::instance</a>()-><a class="code" href="class_qt_mvvm_1_1_service_registry.html#ab683dc8ccbb0e0198f0d5664b1f1f9ca">registerInterface</a><<a class="code" href="class_qt_mvvm_1_1_i_presenter.html">QtMvvm::IPresenter</a>, MyPresenter>();</div><div class="line">}</div><div class="line">Q_COREAPP_STARTUP_FUNCTION(myPresenterInit)</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="ipresenter_8h.html#ace4560167ef93b1f5d79f1b17ec701c7" title="The IID of the QtMvvm::IPresenter class. ">QtMvvm_IPresenterIid</a> </dd></dl>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="ipresenter_8h_source.html#l00036">36</a> of file <a class="el" href="ipresenter_8h_source.html">ipresenter.h</a>.</p>
|
|
</div><h2 class="groupheader">Member Function Documentation</h2>
|
|
<a id="a6bf902cf14d45c44fdcf78743d4e71a7"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a6bf902cf14d45c44fdcf78743d4e71a7">◆ </a></span>present()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">QtMvvm::IPresenter::present </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="class_qt_mvvm_1_1_view_model.html">ViewModel</a> * </td>
|
|
<td class="paramname"><em>viewModel</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const QVariantHash & </td>
|
|
<td class="paramname"><em>params</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><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/qpointer.html">QPointer</a>< <a class="el" href="class_qt_mvvm_1_1_view_model.html">ViewModel</a> > </td>
|
|
<td class="paramname"><em>parent</em> = <code>nullptr</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Called to present a viewmodel. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">viewModel</td><td>The <a class="el" href="class_qt_mvvm_1_1_view_model.html" title="The base class for all viewmodels. ">ViewModel</a> to be presenter </td></tr>
|
|
<tr><td class="paramname">params</td><td>Additional parameters for the viemodel initialization </td></tr>
|
|
<tr><td class="paramname">parent</td><td>An optional parent for the viewmodels view </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="exception"><dt>Exceptions</dt><dd>
|
|
<table class="exception">
|
|
<tr><td class="paramname"><a class="el" href="class_qt_mvvm_1_1_presenter_exception.html" title="An exception to be thrown from the presenter if presenting fails. ">PresenterException</a></td><td>When presenting fails for whatever reason</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>This method should:</p>
|
|
<ol type="1">
|
|
<li>Find and create a view for the viewmodel</li>
|
|
<li>Use the view of the parent viewModel to make the new view a child of that parent view</li>
|
|
<li>Make the viewmodel a child of the view (via <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/qobject.html#setParent">QObject::setParent</a>)</li>
|
|
<li>Call the viewmodels <a class="el" href="class_qt_mvvm_1_1_view_model.html#aed696c49a28b9615d3433c6a27006c70" title="Called by the presenter to initialize the viewmodel. ">ViewModel::onInit</a> method with the given parameters</li>
|
|
<li>Find a presentation method for the view (based on the view/viewmodel and/or parent)</li>
|
|
<li>Show the view to the user</li>
|
|
</ol>
|
|
<p>If this method returns it is assumed the presentation was successful. If you throw the exception, presenting has failed, and the app will automatically destroy the viewmodel and handle cleanups and results.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>If you need to present asynchronous, then you need to perform this step yourself in case the asynchronous presentation failed.</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_qt_mvvm_1_1_i_presenter.html#a6e2921a23d4a8513a80526141f79b4d1" title="Called to present a dialog via a message config. ">IPresenter::showDialog</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="class_qt_mvvm_1_1_widgets_presenter.html#a4f4d51ec8d0dcfa190ee813937aa0166">QtMvvm::WidgetsPresenter</a>, and <a class="el" href="class_qt_mvvm_1_1_quick_presenter.html#a48a41fa588214f7b8a1f2974ae4f541e">QtMvvm::QuickPresenter</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a6e2921a23d4a8513a80526141f79b4d1"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a6e2921a23d4a8513a80526141f79b4d1">◆ </a></span>showDialog()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">QtMvvm::IPresenter::showDialog </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="class_qt_mvvm_1_1_message_config.html">MessageConfig</a> & </td>
|
|
<td class="paramname"><em>config</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="class_qt_mvvm_1_1_message_result.html">MessageResult</a> * </td>
|
|
<td class="paramname"><em>result</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Called to present a dialog via a message config. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">config</td><td>The configuration for the dialog to be shown </td></tr>
|
|
<tr><td class="paramname">result</td><td>A reference to the object to report results to </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="exception"><dt>Exceptions</dt><dd>
|
|
<table class="exception">
|
|
<tr><td class="paramname"><a class="el" href="class_qt_mvvm_1_1_presenter_exception.html" title="An exception to be thrown from the presenter if presenting fails. ">PresenterException</a></td><td>When presenting fails for whatever reason</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>This method should create a simple dialog based of the configuration passed to it. Read the <a class="el" href="class_qt_mvvm_1_1_message_config.html" title="A configuration for a simple dialog to be shown from the core code. ">MessageConfig</a> for more details on the parameters. The <a class="el" href="class_qt_mvvm_1_1_message_config.html#a8ddd0717a5f8a07f520df25743ded0da" title="The general type of dialog to be shown. ">MessageConfig::type</a> and <a class="el" href="class_qt_mvvm_1_1_message_config.html#aa9f8a83b2ce22d09daf24aad158d7974" title="A subtype for the dialog to specify what exactly it should show. ">MessageConfig::subType</a> properties are used to determine the kind of dialog to be shown. The other properties are used to configure the dialog.</p>
|
|
<p>The result is a reference to a result object to report the result value and the pressed button to. The result is owned by the caller, you must never delete it. Use the special "GUI methods" to report the result and configure a close target.</p>
|
|
<p>If this method returns it is assumed the presentation was successful. If you throw the exception, presenting has failed, and the app will automatically complete the message result with the <a class="el" href="class_qt_mvvm_1_1_message_config.html#ad6b7b271e558619f15c5eb9a3cf78fb8a83a48e3acfda22ae83280136ed2f6751" title="Equivalent to QMessageBox::NoButton. ">MessageConfig::NoButton</a> constant.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>If you need to present asynchronous, then you need to perform this step yourself in case the asynchronous presentation failed.</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_qt_mvvm_1_1_i_presenter.html#a6bf902cf14d45c44fdcf78743d4e71a7" title="Called to present a viewmodel. ">IPresenter::present</a>, <a class="el" href="class_qt_mvvm_1_1_message_config.html" title="A configuration for a simple dialog to be shown from the core code. ">MessageConfig</a>, <a class="el" href="class_qt_mvvm_1_1_message_result.html" title="A result watcher to get the result once a dialog has finished. ">MessageResult</a>, <a class="el" href="class_qt_mvvm_1_1_message_result.html#ac43f7ca1c7e3b10e6477c2a5d92348af" title="Completes the dialog and tells the result that it is finished. ">MessageResult::complete</a>, <a class="el" href="class_qt_mvvm_1_1_message_result.html#adf611c77583607f2ea90764871ccd3cd" title="Sets an object and a method to be called to close the dialog. ">MessageResult::setCloseTarget</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="class_qt_mvvm_1_1_widgets_presenter.html#a4766ec05cd6999ee16505d472e48adf9">QtMvvm::WidgetsPresenter</a>, and <a class="el" href="class_qt_mvvm_1_1_quick_presenter.html#afafe3383676b831754482c368fe2b8cc">QtMvvm::QuickPresenter</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="ipresenter_8h_source.html">ipresenter.h</a></li>
|
|
<li>ipresenter.dox</li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Wed Aug 8 2018 19:15:45 for QtMvvm by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.14
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|