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.
407 lines
66 KiB
407 lines
66 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: The qsettingsgenerator Tool</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><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">The qsettingsgenerator Tool </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="toc"><h3>Table of Contents</h3>
|
|
<ul><li class="level1"><a href="#settings_generator_features">Features</a></li>
|
|
<li class="level1"><a href="#settings_generator_usage">Usage</a><ul><li class="level2"><a href="#settings_generator_usage_example">Example</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level1"><a href="#settings_generator_qml">QML-Bindings</a></li>
|
|
<li class="level1"><a href="#settings_generator_format">XML-Format Documentation</a><ul><li class="level2"><a href="#settings_generator_elements">Elements</a><ul><li class="level3"><a href="#settings_generator_elements_Settings">Settings</a><ul><li class="level4"><a href="#settings_generator_elements_Settings_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_Settings_children">Child elements</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_Include">Include</a><ul><li class="level4"><a href="#settings_generator_elements_Include_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_Include_children">Content</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_Backend">Backend</a><ul><li class="level4"><a href="#settings_generator_elements_Backend_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_Backend_children">Child elements</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_Param">Param</a><ul><li class="level4"><a href="#settings_generator_elements_Param_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_Param_children">Content</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_Qml">Qml</a><ul><li class="level4"><a href="#settings_generator_elements_Qml_attributes">Attributes</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_TypeMapping">TypeMapping</a><ul><li class="level4"><a href="#settings_generator_elements_TypeMapping_attributes">Attributes</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_NodeContent">NodeContent Elements</a></li>
|
|
<li class="level3"><a href="#settings_generator_elements_Node">Node</a><ul><li class="level4"><a href="#settings_generator_elements_Node_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_Node_children">Child elements</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_Entry">Entry</a><ul><li class="level4"><a href="#settings_generator_elements_Entry_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_Entry_children">Additional Child elements</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="level3"><a href="#settings_generator_elements_ListNode">ListNode</a></li>
|
|
<li class="level3"><a href="#settings_generator_elements_ImportType">ImportType</a><ul><li class="level4"><a href="#settings_generator_elements_ImportType_attributes">Attributes</a></li>
|
|
<li class="level4"><a href="#settings_generator_elements_ImportType_children">Content</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="level2"><a href="#settings_generator_values">XML-Types</a><ul><li class="level3"><a href="#settings_generator_values_InstanceScope">InstanceScope</a></li>
|
|
<li class="level3"><a href="#settings_generator_values_QmlRegistrationMode">QmlRegistrationMode</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="level1"><a href="#settings_generator_sample">Sample settings generator XML file</a></li>
|
|
<li class="level1"><a href="#settings_xml_xsd">The XSD for the settings files</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="textblock"><p>A tool to generate static, typesafe settings access without having to type key strings</p>
|
|
<p>The general idea is that instead of this: </p><div class="fragment"><div class="line">QSettins settings;</div><div class="line"><span class="keywordtype">int</span> value = settings.value(<span class="stringliteral">"my/key"</span>, 42).toInt();</div></div><!-- fragment --><p>You create a settings file like this: </p><div class="fragment"><div class="line"><<span class="keywordtype">Settings</span> <span class="keyword">name</span>=<span class="stringliteral">"Settings"</span>></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"my"</span>></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"key"</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span> <span class="keyword">default</span>=<span class="stringliteral">"42"</span>/></div><div class="line"> </<span class="keywordtype">Node</span>></div><div class="line"></<span class="keywordtype">Settings</span>></div></div><!-- fragment --><p>And can now access the data like this: </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> value = Settings::instance()->my.key;</div></div><!-- fragment --><p>So in summary: First, using <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/qsettings.html">QSettings</a> requires you to type in strings as keys - which cannot be checked by the compiler. With this tool you get a c++ member hirachie instead - which is checked by the compiler and thus typo free. Also, the values in the settings are made statically typed by using this generator. The second point was to support multiple backends, not only <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/qsettings.html">QSettings</a>, without having to change the frontend code.</p>
|
|
<h1><a class="anchor" id="settings_generator_features"></a>
|
|
Features</h1>
|
|
<ul>
|
|
<li>Access settings via code - no more typos and redundant strings!</li>
|
|
<li>Static typing gives additionl saftey and is easier to use (no <code>.toType()</code> calls needed)</li>
|
|
<li>Default values in one single, central place - less error prone and easier to maintain<ul>
|
|
<li>Can be specified as strings in the xml</li>
|
|
<li>Can be specified as C++ code in the xml</li>
|
|
</ul>
|
|
</li>
|
|
<li>Use as a global single instance or create local instances</li>
|
|
<li>Support for custom settings backends instead of <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/qsettings.html">QSettings</a> alone<ul>
|
|
<li><a class="el" href="class_qt_mvvm_1_1_q_settings_accessor.html" title="A settings accessor implementation that wrapps QSettings. ">QtMvvm::QSettingsAccessor</a> for usage with <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/qsettings.html">QSettings</a> (the default)</li>
|
|
<li><a class="el" href="class_qt_mvvm_1_1_data_sync_settings_accessor.html" title="A settings accessor implementation that allows to store and sync settings via datasync. ">QtMvvm::DataSyncSettingsAccessor</a> to sync settings via <a href="https://github.com/Skycoder42/QtDataSync">QtDataSync</a></li>
|
|
<li><a class="el" href="class_qt_mvvm_1_1_android_settings_accessor.html" title="A wrapper around the android SharedPreferences API. ">QtMvvm::AndroidSettingsAccessor</a> (android only) to access the SharedPreferences</li>
|
|
</ul>
|
|
</li>
|
|
<li>Can be used as an injectable service</li>
|
|
</ul>
|
|
<h1><a class="anchor" id="settings_generator_usage"></a>
|
|
Usage</h1>
|
|
<p>Using QtMvvmCore adds a custom qmake compiler to you project. All you need to do is to create the settings xml definition and then add it to the pro file as <code>SETTINGS_DEFINITIONS += mysettings.xml</code>. This will create a header named "mysettings.h" you can include. That header contains the C++ generated settings class to access the settings.</p>
|
|
<h2><a class="anchor" id="settings_generator_usage_example"></a>
|
|
Example</h2>
|
|
<p>Create a pro file with and add the lines: </p><div class="fragment"><div class="line">QT += mvvmcore</div><div class="line"></div><div class="line">SETTINGS_DEFINITIONS += mysettings.xml</div></div><!-- fragment --><p>Create a file named <code>mysettings.xml</code> and fill it: </p><div class="fragment"><div class="line"><?<span class="keyword">xml</span> <span class="keyword">version</span>=<span class="stringliteral">"1.0"</span> <span class="keyword">encoding</span>=<span class="stringliteral">"UTF-8"</span> ?></div><div class="line"><<span class="keywordtype">Settings</span> <span class="keyword">name</span>=<span class="stringliteral">"MySettings"</span>></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"my"</span>></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"key"</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span> <span class="keyword">default</span>=<span class="stringliteral">"42"</span>/></div><div class="line"> </<span class="keywordtype">Node</span>></div><div class="line"></<span class="keywordtype">Settings</span>></div></div><!-- fragment --><p>Finally, adjust you main to look like this: </p><div class="fragment"><div class="line"><span class="preprocessor">#include <QCoreApplication></span></div><div class="line"><span class="preprocessor">#include <QDebug></span></div><div class="line"><span class="preprocessor">#include "mysettings.h"</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])</div><div class="line">{</div><div class="line"> <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/qcoreapplication.html">QCoreApplication</a> a(argc, argv);</div><div class="line"></div><div class="line"> <span class="keywordtype">int</span> myKey = MySettings::instance()->my.key;</div><div class="line"> qDebug() << myKey;</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="settings_generator_qml"></a>
|
|
QML-Bindings</h1>
|
|
<p>The tool can also generate QML-Bindings, so you can access the settings in the same way from QML. To do so, add to your pro file (in addition to <code>SETTINGS_DEFINITIONS</code>): </p><div class="fragment"><div class="line">QML_SETTINGS_DEFINITIONS += mysettings.xml</div></div><!-- fragment --><p>And also add some QML metadata using the Qml element in the settings </p><div class="fragment"><div class="line"><?<span class="keyword">xml</span> <span class="keyword">version</span>=<span class="stringliteral">"1.0"</span> <span class="keyword">encoding</span>=<span class="stringliteral">"UTF-8"</span> ?></div><div class="line"><<span class="keywordtype">Settings</span> <span class="keyword">name</span>=<span class="stringliteral">"MySettings"</span>></div><div class="line"> <<span class="keywordtype">Qml</span> <span class="keyword">uri</span>=<span class="stringliteral">"com.example.settings"</span></div><div class="line"> <span class="keyword">major</span>=<span class="stringliteral">"1"</span></div><div class="line"> <span class="keyword">minor</span>=<span class="stringliteral">"0"</span>/></div><div class="line"> <span class="comment"><!-- ... --></span></div><div class="line"></<span class="keywordtype">Settings</span>></div></div><!-- fragment --><p>And with that, you can use the specified uri to access the settings from QML: </p><div class="fragment"><div class="line"><span class="keyword">import</span> com.example.settings 1.0</div><div class="line"></div><div class="line">SomeItem {</div><div class="line"> someProperty: MySettings.my.key</div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="settings_generator_format"></a>
|
|
XML-Format Documentation</h1>
|
|
<p>The following sections document the different elements and attributes in the XML format used by the generator.</p>
|
|
<h2><a class="anchor" id="settings_generator_elements"></a>
|
|
Elements</h2>
|
|
<p>The possible elements of such a file.</p>
|
|
<h3><a class="anchor" id="settings_generator_elements_Settings"></a>
|
|
Settings</h3>
|
|
<p>The root Element of the XML document. It defines meta-stuff and the actual nodes and entries.</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_Settings_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">name </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>filename</em> </td><td class="markdownTableBodyNone">The C++ class name of the generated class </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">prefix </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>empty</em> </td><td class="markdownTableBodyNone">Specify an export macro. The value is put before the class definition, if you want to export the generated class from a dynamic library </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">baseKey </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>empty</em> </td><td class="markdownTableBodyNone">A base settings key that is prepended to all keys </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">scope </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_values_InstanceScope">InstanceScope</a> </td><td class="markdownTableBodyNone">DestroyOnAppDestroy </td><td class="markdownTableBodyNone">The destruction scope of the create service instance </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_Settings_children"></a>
|
|
Child elements</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">XML-Type </th><th class="markdownTableHeadNone">Limits </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">Include </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_Include">Include</a> </td><td class="markdownTableBodyNone">0 - ∞ </td><td class="markdownTableBodyNone">A header file to be included </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">Backend </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_Backend">Backend</a> </td><td class="markdownTableBodyNone">0 - 1 </td><td class="markdownTableBodyNone">The definition of the settings backend to use </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">Qml </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_Qml">Qml</a> </td><td class="markdownTableBodyNone">0 - 1 </td><td class="markdownTableBodyNone">Special configuration parameters for the QML bindings </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">TypeMapping </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_TypeMapping">TypeMapping</a> </td><td class="markdownTableBodyNone">0 - ∞ </td><td class="markdownTableBodyNone">Type mappings to map abstract type names to C++ types </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone"><node> </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_NodeContent">NodeContent Elements</a> </td><td class="markdownTableBodyNone">0 - ∞ </td><td class="markdownTableBodyNone">General "node-like" elements, that can be inside any node-like element </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_elements_Include"></a>
|
|
Include</h3>
|
|
<p>Describes a file to be included via a c++ include directive. You can use them if you want to make use of special classes in your generated classes. Both global includes (#include <header>) and local includes (#include "header") are supported.<br />
|
|
</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_Include_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">local </td><td class="markdownTableBodyNone">bool </td><td class="markdownTableBodyNone">false </td><td class="markdownTableBodyNone">Specifies whether the include is a global or a local include </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_Include_children"></a>
|
|
Content</h4>
|
|
<p>The content of this element must be a string. More specific the header to be included. It becomes the content of the include directive. Specifiy it without the braces or quores, as thoes are added automatically.</p>
|
|
<h3><a class="anchor" id="settings_generator_elements_Backend"></a>
|
|
Backend</h3>
|
|
<p>The backend element can be used to select a different <a class="el" href="class_qt_mvvm_1_1_i_settings_accessor.html" title="An interface to provide a generic way to access settings of any origin. ">QtMvvm::ISettingsAccessor</a> instead of the standard <a class="el" href="class_qt_mvvm_1_1_q_settings_accessor.html" title="A settings accessor implementation that wrapps QSettings. ">QtMvvm::QSettingsAccessor</a>.</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_Backend_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">class </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The C++ class name of the backend to be used. Must be a class that implements <a class="el" href="class_qt_mvvm_1_1_i_settings_accessor.html" title="An interface to provide a generic way to access settings of any origin. ">QtMvvm::ISettingsAccessor</a> </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_Backend_children"></a>
|
|
Child elements</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">XML-Type </th><th class="markdownTableHeadNone">Limits </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">Param </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_Param">Param</a> </td><td class="markdownTableBodyNone">0 - ∞ </td><td class="markdownTableBodyNone">A parameter to be passed to the backends constructor, before the QObject* parent </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_elements_Param"></a>
|
|
Param</h3>
|
|
<p>A generic parameter to be passed to C++ method.</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_Param_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">type </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The C++ class name of type of the parameter. </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">asStr </td><td class="markdownTableBodyNone">bool </td><td class="markdownTableBodyNone">false </td><td class="markdownTableBodyNone">Specify how the element content should be interpreted </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_Param_children"></a>
|
|
Content</h4>
|
|
<p>The content of a param represents the value of the parameter. How the content is interpreted depends on the asStr attribute.</p>
|
|
<p>If it is set to false (the default), the content must be c++ code and is copied to the generated class as is. The code must be an expression that evalutes to a single value that is implicitly convertible to the given type. If type was for example int, valid expressions could be:</p>
|
|
<div class="fragment"><div class="line"><<span class="keywordtype">Param</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span>>-1</<span class="keywordtype">Param</span>></div><div class="line"><<span class="keywordtype">Param</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span>>10 + 20</<span class="keywordtype">Param</span>></div><div class="line"><<span class="keywordtype">Param</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span>><span class="keyword">qRand</span>()</<span class="keywordtype">Param</span>></div></div><!-- fragment --><p>If set to true, the content is assumed to be a string. You don't need to specify quotation marks around the string. That string is used to initialize a <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> that is then converted to type - in other words, the type you use must be variant convertible from a string. This can be used to, for example, create a <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/qdate.html">QDate</a> from a string with the value of <code><Param type="QDate" asStr="true">2018-05-09</Param></code>.<br />
|
|
</p>
|
|
<h3><a class="anchor" id="settings_generator_elements_Qml"></a>
|
|
Qml</h3>
|
|
<p>The Qml element contains special properties that are only used for QML binding generation.</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_Qml_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">uri </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The QML-Import URI for the QML module </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">major </td><td class="markdownTableBodyNone">int </td><td class="markdownTableBodyNone">1 </td><td class="markdownTableBodyNone">The major version of the generated module </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">minor </td><td class="markdownTableBodyNone">int </td><td class="markdownTableBodyNone">0 </td><td class="markdownTableBodyNone">The minor version of the generated module </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">type </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_values_QmlRegistrationMode">QmlRegistrationMode</a> </td><td class="markdownTableBodyNone">Singleton </td><td class="markdownTableBodyNone">The mode on how to register the instance in QML </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">register </td><td class="markdownTableBodyNone">bool </td><td class="markdownTableBodyNone">true </td><td class="markdownTableBodyNone">Specify, if the type should be registered automatically </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">header </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>empty</em> </td><td class="markdownTableBodyNone">A custom path to the generate C++-Code of the settings generator, if it can't be the default path </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_elements_TypeMapping"></a>
|
|
TypeMapping</h3>
|
|
<p>Type mappings allow you to specify the C++-type of an arbitrary type to be replaced by in the generated code. This can be useful when importing a <a class="el" href="settings_xml.html">Settings-XML</a> file.</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_TypeMapping_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">key </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The fake type name </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">type </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The C++-type to replace it with </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_elements_NodeContent"></a>
|
|
NodeContent Elements</h3>
|
|
<p>Elements that have the NodeContent as child type can have a combination of the following actual child elements. Can can be unordered and mixed in any way:</p>
|
|
<ul>
|
|
<li><a class="el" href="settings_generator.html#settings_generator_elements_Node">Node</a></li>
|
|
<li><a class="el" href="settings_generator.html#settings_generator_elements_Entry">Entry</a></li>
|
|
<li><a class="el" href="settings_generator.html#settings_generator_elements_ListNode">ListNode</a></li>
|
|
<li>settings_generator_elements_Import</li>
|
|
</ul>
|
|
<h3><a class="anchor" id="settings_generator_elements_Node"></a>
|
|
Node</h3>
|
|
<p>The node represents a sub-group within the settings. All elements within the node will have the node's key prepended to their key (seperated by a <code>/</code>)</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_Node_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">key </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The name (and group key) of the node </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_Node_children"></a>
|
|
Child elements</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">XML-Type </th><th class="markdownTableHeadNone">Limits </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone"><node> </td><td class="markdownTableBodyNone"><a class="el" href="settings_generator.html#settings_generator_elements_NodeContent">NodeContent Elements</a> </td><td class="markdownTableBodyNone">0 - ∞ </td><td class="markdownTableBodyNone">General "node-like" elements, that can be inside any node-like element </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_elements_Entry"></a>
|
|
Entry</h3>
|
|
<p>The Entry element is an extension of the <a class="el" href="settings_generator.html#settings_generator_elements_Node">Node</a> type. This means it's the same as a Node, but with additional properties.</p>
|
|
<p>The entry represents a leaf entry in the settings, with a value that can be loaded and stored from the settings via the entry's key (within the node subgroups). Entries themselves can also be used as a node as well, and thus contain child elements, too.</p>
|
|
<p>The default value can be specified in 2 ways. Either as a string (via the attribute) that is converted to the target type using <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>, or via the <code><Code></code> child element, that contains actual C++-Code that evaluates to a default value.</p>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_qt_mvvm_1_1_settings_entry.html" title="A generic wrapper around ISettingsAccessor used by the qsettingsgenerator. ">QtMvvm::SettingsEntry</a></dd></dl>
|
|
<h4><a class="anchor" id="settings_generator_elements_Entry_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">type </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>required</em> </td><td class="markdownTableBodyNone">The C++-type that this entry saves and loads. Can be a virtual type, that is resolved by a <a class="el" href="settings_generator.html#settings_generator_elements_TypeMapping">TypeMapping</a> </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">qmlGroupKey </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><code><key>Group</code> </td><td class="markdownTableBodyNone">The name the property that holds the entries sub-nodes for the QML binding </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">default </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>empty</em> </td><td class="markdownTableBodyNone">A default value (as string) to be returned if the entry is not stored in the settings </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">tr </td><td class="markdownTableBodyNone">bool </td><td class="markdownTableBodyNone">false </td><td class="markdownTableBodyNone">Specify whether the default value should be translated </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">trContext </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>filename</em> </td><td class="markdownTableBodyNone">A custom translation context to use instead of the filename </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_Entry_children"></a>
|
|
Additional Child elements</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">XML-Type </th><th class="markdownTableHeadNone">Limits </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">Code </td><td class="markdownTableBodyNone">settings_generator_elements_Code </td><td class="markdownTableBodyNone">0 - 1 </td><td class="markdownTableBodyNone">C++-Code to create a default value </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_elements_ListNode"></a>
|
|
ListNode</h3>
|
|
<p>The ListNode element is an extension of the <a class="el" href="settings_generator.html#settings_generator_elements_Node">Node</a> type. This means it's the same as a Node, but with additional properties.</p>
|
|
<p>The ListNode is a special node that allows you to easily store lists of elements. All children that are defined within a listnode are part of the "array elements", so you will access elements in a list node via <code>listNode[2].group.entry</code> and can append and remove elements from that list.</p>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_qt_mvvm_1_1_settings_list_node.html" title="A helper class used by the qsettingsgenerator to represent list nodes. ">QtMvvm::SettingsListNode</a></dd></dl>
|
|
<h3><a class="anchor" id="settings_generator_elements_ImportType"></a>
|
|
ImportType</h3>
|
|
<p>The Imports allow you to include other files within this one as sub elements. You can include either a Settings-Generator-XML (this file) or a <a class="el" href="settings_xml.html">Settings-XML</a>. The imported file is then treated like it's contents where simply defined instead of the import element, allowing seemless combination of different files.</p>
|
|
<p>You can use the rootNode to instead of importing the root element in the importet file, go down to the node that matches the key defined by rootNode and only import that part.</p>
|
|
<h4><a class="anchor" id="settings_generator_elements_ImportType_attributes"></a>
|
|
Attributes</h4>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Type </th><th class="markdownTableHeadNone">Default/Required </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">required </td><td class="markdownTableBodyNone">bool </td><td class="markdownTableBodyNone">true </td><td class="markdownTableBodyNone">Specify, if the import is required or optional </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">rootNode </td><td class="markdownTableBodyNone">string </td><td class="markdownTableBodyNone"><em>empty</em> </td><td class="markdownTableBodyNone">A root node withing the imported file to use as a starting point </td></tr>
|
|
</table>
|
|
<h4><a class="anchor" id="settings_generator_elements_ImportType_children"></a>
|
|
Content</h4>
|
|
<p>The content of the element is a string - the path to the file to be imported. If the path is a relative path, it is resolved relative to the file that is importing it, aka "this" file.</p>
|
|
<h2><a class="anchor" id="settings_generator_values"></a>
|
|
XML-Types</h2>
|
|
<p>The XML-Types are not elements, but values of attributes etc. that have been defined for the file.</p>
|
|
<h3><a class="anchor" id="settings_generator_values_InstanceScope"></a>
|
|
InstanceScope</h3>
|
|
<p>InstanceScope is a simple enum with the following allowed values:</p>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">DestroyOnAppQuit </td><td class="markdownTableBodyNone">Sets the scope of the created mvvm service to <a class="el" href="class_qt_mvvm_1_1_service_registry.html#aff6b990faf118b6305c6d6cd4cacb276a7aac3331077c91c6ae5fe677b91b35c6" title="Destroy when the QCoreApplication::aboutToQuit signal is emitted. ">QtMvvm::ServiceRegistry::DestroyOnAppQuit</a> </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">DestroyOnAppDestroy </td><td class="markdownTableBodyNone">Sets the scope of the created mvvm service to <a class="el" href="class_qt_mvvm_1_1_service_registry.html#aff6b990faf118b6305c6d6cd4cacb276a7a43a0e97844c62bf966b828fb2b7b45" title="Destroy as soon as the QCoreApplication gets destroyed (typically end of main) ">QtMvvm::ServiceRegistry::DestroyOnAppDestroy</a> </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">DestroyOnRegistryDestroy </td><td class="markdownTableBodyNone">Sets the scope of the created mvvm service to <a class="el" href="class_qt_mvvm_1_1_service_registry.html#aff6b990faf118b6305c6d6cd4cacb276a2cf5729a4b8c072676f052b361c6397b" title="Destroy together with the service registry instance (static memory, unspecified order!) ...">QtMvvm::ServiceRegistry::DestroyOnRegistryDestroy</a> </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">DestroyNever </td><td class="markdownTableBodyNone">Sets the scope of the created mvvm service to <a class="el" href="class_qt_mvvm_1_1_service_registry.html#aff6b990faf118b6305c6d6cd4cacb276aab3fbc747b7a7ba03fa19fe2d50704f7" title="Never destroy the instance. ">QtMvvm::ServiceRegistry::DestroyNever</a> </td></tr>
|
|
</table>
|
|
<h3><a class="anchor" id="settings_generator_values_QmlRegistrationMode"></a>
|
|
QmlRegistrationMode</h3>
|
|
<p>InstanceScope is a simple enum with the following allowed values:</p>
|
|
<table class="markdownTable">
|
|
<tr class="markdownTableHead">
|
|
<th class="markdownTableHeadNone">Name </th><th class="markdownTableHeadNone">Description </th></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">Singleton </td><td class="markdownTableBodyNone">Register the QML type as a singleton instance </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">Uncreatable </td><td class="markdownTableBodyNone">Register the QML type as a uncreatable type </td></tr>
|
|
<tr class="markdownTableBody" class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">Creatable </td><td class="markdownTableBodyNone">Register the QML type as a normal, constructable type </td></tr>
|
|
</table>
|
|
<h1><a class="anchor" id="settings_generator_sample"></a>
|
|
Sample settings generator XML file</h1>
|
|
<p>The following code block is a sample of a settings generator XML file. It's a little bigger to show of the capabilities</p>
|
|
<div class="fragment"><div class="line"><?<span class="keyword">xml</span> <span class="keyword">version</span>=<span class="stringliteral">"1.0"</span> <span class="keyword">encoding</span>=<span class="stringliteral">"UTF-8"</span> ?></div><div class="line"><<span class="keywordtype">Settings</span> <span class="keyword">name</span>=<span class="stringliteral">"TestSettings"</span></div><div class="line"> <span class="keyword">prefix</span>=<span class="stringliteral">"SOME_EXPORT"</span></div><div class="line"> <span class="keyword">baseKey</span>=<span class="stringliteral">"tests"</span></div><div class="line"> <span class="keyword">scope</span>=<span class="stringliteral">"DestroyOnAppQuit"</span>></div><div class="line"> <<span class="keywordtype">Include</span>><span class="keyword">QtCore</span>/<span class="keyword">QDateTime</span></<span class="keywordtype">Include</span>></div><div class="line"> <<span class="keywordtype">Include</span> <span class="keyword">local</span>=<span class="stringliteral">"false"</span>><span class="keyword">QtCore</span>/<span class="keyword">QUrl</span></<span class="keywordtype">Include</span>></div><div class="line"> <<span class="keywordtype">Include</span> <span class="keyword">local</span>=<span class="stringliteral">"true"</span>><span class="keyword">testbackend.h</span></<span class="keywordtype">Include</span>></div><div class="line"></div><div class="line"> <<span class="keywordtype">Backend</span> <span class="keyword">class</span>=<span class="stringliteral">"TestBackend"</span>></div><div class="line"> <<span class="keywordtype">Param</span> <span class="keyword">type</span>=<span class="stringliteral">"QString"</span> <span class="keyword">asStr</span>=<span class="stringliteral">"true"</span>><span class="keyword">Test</span> <span class="keyword">Backend</span></<span class="keywordtype">Param</span>></div><div class="line"> <<span class="keywordtype">Param</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span>>42</<span class="keywordtype">Param</span>></div><div class="line"> </<span class="keywordtype">Backend</span>></div><div class="line"></div><div class="line"> <<span class="keywordtype">TypeMapping</span> <span class="keyword">key</span>=<span class="stringliteral">"range"</span> <span class="keyword">type</span>=<span class="stringliteral">"int"</span>/></div><div class="line"></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"emptyNode"</span>/></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"emptyEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"bool"</span>/></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"advancedEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"QString"</span></div><div class="line"> <span class="keyword">qmlGroupKey</span>=<span class="stringliteral">"qmlAdvancedEntry"</span></div><div class="line"> <span class="keyword">default</span>=<span class="stringliteral">"Hello World"</span></div><div class="line"> <span class="keyword">tr</span>=<span class="stringliteral">"true"</span></div><div class="line"> <span class="keyword">trContext</span>=<span class="stringliteral">"some_context"</span>/></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"codeEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"QUrl"</span>></div><div class="line"> <<span class="keywordtype">Code</span>><span class="keyword">QUrl::fromLocalFile</span>(<span class="keyword">QStringLiteral</span>(<span class="stringliteral">"/path/to/something"</span>))</<span class="keywordtype">Code</span>></div><div class="line"> </<span class="keywordtype">Entry</span>></div><div class="line"></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"parentNode"</span>></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"emptyChildNode"</span>/></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"fullChildNode"</span>></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"replaceEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"range"</span></div><div class="line"> <span class="keyword">default</span>=<span class="stringliteral">"42"</span>/></div><div class="line"> </<span class="keywordtype">Node</span>></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"parentEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"bool"</span></div><div class="line"> <span class="keyword">default</span>=<span class="stringliteral">"true"</span>></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"subNode"</span>/></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"nodeWithCodeEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"int"</span>></div><div class="line"> <<span class="keywordtype">Node</span> <span class="keyword">key</span>=<span class="stringliteral">"someNode"</span>/></div><div class="line"> <<span class="keywordtype">Code</span>></div><div class="line"> <span class="keyword">qRound</span>(42.8)</div><div class="line"> </<span class="keywordtype">Code</span>></div><div class="line"> </<span class="keywordtype">Entry</span>></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"leafEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"QString"</span></div><div class="line"> <span class="keyword">default</span>=<span class="stringliteral">"translate me"</span></div><div class="line"> <span class="keyword">tr</span>=<span class="stringliteral">"true"</span>/></div><div class="line"> </<span class="keywordtype">Entry</span>></div><div class="line"> </<span class="keywordtype">Node</span>></div><div class="line"></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"voidEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"void"</span>/></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"variantEntry"</span></div><div class="line"> <span class="keyword">type</span>=<span class="stringliteral">"QVariant"</span>/></div><div class="line"> <<span class="keywordtype">Entry</span> <span class="keyword">key</span>=<span class="stringliteral">"simpleListEntry"</span></div><div class="line"> <span class="keyword">type</span>="<span class="keyword">QList</span>&<span class="keyword">lt</span>;<span class="keyword">int</span>&<span class="keyword">gt</span>;<span class="stringliteral">"></span></div><div class="line"><span class="stringliteral"> <Code>{42}</Code></span></div><div class="line"><span class="stringliteral"> </Entry></span></div><div class="line"><span class="stringliteral"></span></div><div class="line"><span class="stringliteral"> <ListNode key="</span><span class="keyword">listNode</span><span class="stringliteral">"></span></div><div class="line"><span class="stringliteral"> <Entry key="</span><span class="keyword">simpleChild</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> type="</span><span class="keyword">bool</span><span class="stringliteral">"/></span></div><div class="line"><span class="stringliteral"> <Node key="</span><span class="keyword">someNode</span><span class="stringliteral">"></span></div><div class="line"><span class="stringliteral"> <Entry key="</span><span class="keyword">deepChild</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> type="</span><span class="keyword">int</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> default="</span>22<span class="stringliteral">"/></span></div><div class="line"><span class="stringliteral"> <Entry key="</span><span class="keyword">deepParent</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> type="</span><span class="keyword">QString</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> default="</span><span class="keyword">___</span><span class="stringliteral">"></span></div><div class="line"><span class="stringliteral"> <Entry key="</span><span class="keyword">simpleChild</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> type="</span><span class="keyword">bool</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> default="</span><span class="keyword">true</span><span class="stringliteral">"/></span></div><div class="line"><span class="stringliteral"> </Entry></span></div><div class="line"><span class="stringliteral"> </Node></span></div><div class="line"><span class="stringliteral"> <ListNode key="</span><span class="keyword">childList</span><span class="stringliteral">"></span></div><div class="line"><span class="stringliteral"> <Entry key="</span><span class="keyword">valueEntry</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> type="</span><span class="keyword">double</span><span class="stringliteral">"</span></div><div class="line"><span class="stringliteral"> default="</span>4.2"/></div><div class="line"> </<span class="keywordtype">ListNode</span>></div><div class="line"> </<span class="keywordtype">ListNode</span>></div><div class="line"></<span class="keywordtype">Settings</span>></div></div><!-- fragment --><h1><a class="anchor" id="settings_xml_xsd"></a>
|
|
The XSD for the settings files</h1>
|
|
<p>The following file is the XSD the parser operates on. You can use it to verify your settings xml files.</p>
|
|
<div class="fragment"><div class="line"><?xml version="1.0" encoding="UTF-8"?></div><div class="line"><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"</div><div class="line"> xmlns:qxg="https://skycoder42.de/xml/schemas/QXmlCodeGen"></div><div class="line"> <!-- QXG Definitions --></div><div class="line"> <qxg:config class="SettingsGeneratorBase"</div><div class="line"> stdcompat="true"</div><div class="line"> schemaUrl="qrc:/schemas/qsettingsgenerator.xsd"></div><div class="line"> <qxg:include>QtCore/QHash</qxg:include></div><div class="line"> </qxg:config></div><div class="line"> <qxg:method name="read_type_mapping" type="QHash&lt;QString, QString&gt;" asGroup="true"/></div><div class="line"> <qxg:method name="read_included_file" type="NodeContentGroup"/></div><div class="line"></div><div class="line"> <!-- Basic Types --></div><div class="line"> <xs:simpleType name="QmlRegistrationMode"></div><div class="line"> <xs:restriction base="xs:string"></div><div class="line"> <xs:enumeration value="Singleton"/></div><div class="line"> <xs:enumeration value="Uncreatable"/></div><div class="line"> <xs:enumeration value="Creatable"/></div><div class="line"> </xs:restriction></div><div class="line"> </xs:simpleType></div><div class="line"></div><div class="line"> <xs:simpleType name="InstanceScope"></div><div class="line"> <xs:restriction base="xs:string"></div><div class="line"> <xs:enumeration value="DestroyOnAppQuit"/></div><div class="line"> <xs:enumeration value="DestroyOnAppDestroy"/></div><div class="line"> <xs:enumeration value="DestroyOnRegistryDestroy"/></div><div class="line"> <xs:enumeration value="DestroyNever"/></div><div class="line"> </xs:restriction></div><div class="line"> </xs:simpleType></div><div class="line"></div><div class="line"> <!-- Type definitions --></div><div class="line"> <xs:complexType name="IncludeType"></div><div class="line"> <xs:simpleContent></div><div class="line"> <xs:extension base="xs:string" qxg:member="includePath"></div><div class="line"> <xs:attribute name="local" type="xs:boolean" use="optional" default="false"/></div><div class="line"> </xs:extension></div><div class="line"> </xs:simpleContent></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="QmlType"></div><div class="line"> <xs:attribute name="uri" type="xs:string" use="required"/></div><div class="line"> <xs:attribute name="major" type="xs:integer" use="optional" default="1"/></div><div class="line"> <xs:attribute name="minor" type="xs:integer" use="optional" default="0"/></div><div class="line"> <xs:attribute name="type" type="QmlRegistrationMode" use="optional" default="Singleton"/></div><div class="line"> <xs:attribute name="register" type="xs:boolean" use="optional" default="true" qxg:member="autoRegister"/></div><div class="line"> <xs:attribute name="header" type="xs:string" use="optional"/></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="ImportType"></div><div class="line"> <xs:simpleContent></div><div class="line"> <xs:extension base="xs:string" qxg:member="importPath"></div><div class="line"> <xs:attribute name="required" type="xs:boolean" use="optional" default="true"/></div><div class="line"> <xs:attribute name="rootNode" type="xs:string" use="optional"/></div><div class="line"> </xs:extension></div><div class="line"> </xs:simpleContent></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="TypeMappingEntry"></div><div class="line"> <xs:attribute name="key" type="xs:string" use="required"/></div><div class="line"> <xs:attribute name="type" type="xs:string" use="required"/></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:group name="TypeMappingGroup"></div><div class="line"> <xs:sequence></div><div class="line"> <xs:element maxOccurs="unbounded" minOccurs="0" name="TypeMapping" type="TypeMappingEntry"/></div><div class="line"> </xs:sequence></div><div class="line"> </xs:group></div><div class="line"></div><div class="line"> <xs:complexType name="ParamType"></div><div class="line"> <xs:simpleContent></div><div class="line"> <xs:extension base="xs:string" qxg:member="value"></div><div class="line"> <xs:attribute name="type" type="xs:string" use="required"/></div><div class="line"> <xs:attribute name="asStr" type="xs:boolean" use="optional" default="false"/></div><div class="line"> </xs:extension></div><div class="line"> </xs:simpleContent></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="BackendType"></div><div class="line"> <xs:sequence></div><div class="line"> <xs:element maxOccurs="unbounded" minOccurs="0" name="Param" type="ParamType"/></div><div class="line"> </xs:sequence></div><div class="line"> <xs:attribute name="class" type="xs:string" use="required" qxg:member="className"/></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:group name="NodeContentGroup"></div><div class="line"> <xs:sequence></div><div class="line"> <xs:choice maxOccurs="unbounded" minOccurs="0" qxg:member="contentNodes"></div><div class="line"> <xs:element name="Node" type="NodeType"/></div><div class="line"> <xs:element name="Entry" type="EntryType"/></div><div class="line"> <xs:element name="ListNode" type="ListNodeType"/></div><div class="line"> <xs:element name="Import" type="ImportType" qxg:method="read_included_file"/></div><div class="line"> </xs:choice></div><div class="line"> </xs:sequence></div><div class="line"> </xs:group></div><div class="line"></div><div class="line"> <xs:complexType name="NodeType" qxg:declare="true"></div><div class="line"> <xs:group ref="NodeContentGroup" qxg:inherit="true"/></div><div class="line"> <xs:attribute name="key" type="xs:string" use="required"/></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="ListNodeType" qxg:declare="true"></div><div class="line"> <xs:complexContent></div><div class="line"> <xs:extension base="NodeType"/></div><div class="line"> </xs:complexContent></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="EntryType" qxg:declare="true"></div><div class="line"> <xs:complexContent></div><div class="line"> <xs:extension base="NodeType"></div><div class="line"> <xs:sequence></div><div class="line"> <xs:element maxOccurs="1" minOccurs="0" name="Code" type="xs:string"/></div><div class="line"> </xs:sequence></div><div class="line"> <xs:attribute name="type" type="xs:string" use="required"/></div><div class="line"> <xs:attribute name="qmlGroupKey" type="xs:string" use="optional"/></div><div class="line"> <xs:attribute name="default" type="xs:string" use="optional" qxg:member="defaultValue"/></div><div class="line"> <xs:attribute name="tr" type="xs:boolean" default="false" use="optional"/></div><div class="line"> <xs:attribute name="trContext" type="xs:string" use="optional"/></div><div class="line"> </xs:extension></div><div class="line"> </xs:complexContent></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <xs:complexType name="SettingsType"></div><div class="line"> <xs:sequence></div><div class="line"> <xs:element maxOccurs="unbounded" minOccurs="0" name="Include" type="IncludeType" qxg:member="includes"/></div><div class="line"> <xs:element maxOccurs="1" minOccurs="0" name="Backend" type="BackendType"/></div><div class="line"> <xs:element maxOccurs="1" minOccurs="0" name="Qml" type="QmlType"/></div><div class="line"> <xs:group ref="TypeMappingGroup" qxg:member="typeMappings" qxg:method="read_type_mapping"/></div><div class="line"> <xs:group ref="NodeContentGroup" qxg:inherit="true"/></div><div class="line"> </xs:sequence></div><div class="line"> <xs:attribute name="name" type="xs:string" use="optional"/></div><div class="line"> <xs:attribute name="prefix" type="xs:string" use="optional"/></div><div class="line"> <xs:attribute name="baseKey" type="xs:string" use="optional"/></div><div class="line"> <xs:attribute name="scope" type="InstanceScope" use="optional"/></div><div class="line"> </xs:complexType></div><div class="line"></div><div class="line"> <!-- root elements--></div><div class="line"> <xs:element name="Settings" type="SettingsType"/></div><div class="line"></xs:schema></div></div><!-- fragment --> </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  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.14
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|