/usr/share/qt5/doc/qtquickcontrols2/qtquickcontrols2-differences.html is in qtquickcontrols2-5-doc-html 5.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtquickcontrols2-differences.qdoc -->
<title>Differences between Qt Quick Controls | Qt Quick Controls 2 5.7</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
window.onload = function(){document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");};
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.7</td><td ><a href="qtquickcontrols2-index.html">Qt Quick Controls 2</a></td><td >Differences between Qt Quick Controls</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.7.1 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level2"><a href="#c-and-qml">C++ and QML</a></li>
<li class="level2"><a href="#styles">Styles</a></li>
<li class="level2"><a href="#modularity-and-simplicity">Modularity and Simplicity</a></li>
<li class="level2"><a href="#feature-comparison-table">Feature Comparison Table</a></li>
<li class="level2"><a href="#porting-qt-quick-controls-code">Porting Qt Quick Controls Code</a></li>
<li class="level1"><a href="#related-information">Related Information</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Differences between Qt Quick Controls</h1>
<span class="subtitle"></span>
<!-- $$$qtquickcontrols2-differences.html-description -->
<div class="descr"> <a name="details"></a>
<p>Qt Quick Controls were originally developed to support desktop platforms, with mobile and embedded support coming shortly afterwards. They have a very broad scope, in that they provide a styling system flexible enough to allow the development of applications that have either a platform-dependent or platform-independent style.</p>
<p>On embedded systems, where the hardware has limited resources, this approach can be inefficient. Qt Quick Controls 2 were designed to solve this problem, using <a href="https://blog.qt.io/blog/2015/03/31/qt-quick-controls-for-embedded/">benchmarks</a> to guide the development.</p>
<a name="c-and-qml"></a>
<h3 >C++ and QML</h3>
<p>In many cases, the internal state of a control can be more efficiently processed in C++. For example, handling input events in C++ makes a difference for controls that would otherwise need to create internal MouseAreas and attached Keys objects.</p>
<a name="styles"></a>
<h3 >Styles</h3>
<p>Not only does handling events and logic in C++ increase performance, but it allows the visual QML layer to be a simple, declarative layer on top. This is reflected in the structure of the controls project: all visual implementations sit in the <i>imports</i> folder, so that users who want to create their own complete style can copy the folder and start tweaking. Read more about implementing a style plugin <a href="qtquickcontrols2-customize.html#creating-a-custom-style">here</a>.</p>
<p>In Qt Quick Controls 2, styles no longer provide components that are dynamically instantiated by controls, but controls themselves consist of item delegates that can be replaced. In effect, this means that delegates are Qt Quick items that are instantiated on the spot, as properties of the control, and are simply parented to the control.</p>
<a name="modularity-and-simplicity"></a>
<h3 >Modularity and Simplicity</h3>
<p>When it comes to more complex controls, it is sometimes better to split them up into separate building blocks. As an example, the complex ScrollView control:</p>
<pre class="qml">
<span class="type">ScrollView</span> {
<span class="name">horizontalScrollBarPolicy</span>: <span class="name">Qt</span>.<span class="name">ScrollBarAlwaysOff</span>
<span class="type">Flickable</span> {
<span class="comment">// ...</span>
}
}
</pre>
<p>Is replaced with simple <a href="qml-qtquick-controls2-scrollbar.html">ScrollBar</a>/<a href="qml-qtquick-controls2-scrollindicator.html">ScrollIndicator</a> controls that can be attached to any Flickable:</p>
<pre class="qml">
<span class="type">Flickable</span> {
<span class="comment">// ...</span>
<span class="name">ScrollBar</span>.vertical: <span class="name">ScrollBar</span> { }
}
</pre>
<p>The API of Qt Quick Controls 2 aims to be clean and simple. Common operations are easy, and more advanced ones are liberally documented with snippets that can be copied into your code.</p>
<a name="feature-comparison-table"></a>
<h3 >Feature Comparison Table</h3>
<div class="table"><table class="generic">
<thead><tr class="qt-style"><th ></th><th >Qt Quick Controls</th><th >Qt Quick Controls 2</th></tr></thead>
<tr valign="top" class="odd"><td >Stylable delegates</td><td >Yes</td><td >Yes</td></tr>
<tr valign="top" class="even"><td >Pre-built native styles</td><td >Yes</td><td >No</td></tr>
<tr valign="top" class="odd"><td >Runtime style changes</td><td >Yes</td><td >Yes</td></tr>
<tr valign="top" class="even"><td >Can be used on Desktop</td><td >Yes</td><td >Yes <b>*</b></td></tr>
<tr valign="top" class="odd"><td >Can be used on Mobile</td><td >Yes</td><td >Yes</td></tr>
<tr valign="top" class="even"><td >Can be used on Embedded</td><td >Yes</td><td >Yes</td></tr>
<tr valign="top" class="odd"><td >Internal event handling</td><td >QML</td><td >C++</td></tr>
</table></div>
<p><b>* No hover effects</b></p>
<a name="porting-qt-quick-controls-code"></a>
<h3 >Porting Qt Quick Controls Code</h3>
<p>The API of Qt Quick Controls 2 is very similar to Qt Quick Controls, but it does come with some changes necessary to facilitate the improvements. The majority of changes are to do with styling; all of a control's delegates are now accessible in the control itself, instead of in a separate style object.</p>
<p>For example, to style a button in Qt Quick Controls:</p>
<pre class="cpp plain">
Button {
style: ButtonStyle {
label: Label {
// ...
}
}
}
</pre>
<p>To style a button in Qt Quick Controls 2:</p>
<pre class="qml">
<span class="type">Button</span> {
<span class="name">contentItem</span>: <span class="name">Label</span> {
<span class="comment">// ...</span>
}
}
</pre>
<a name="preparing-for-migration"></a>
<h4 >Preparing for Migration</h4>
<p>With this in mind, a good way to prepare for a migration to Qt Quick Controls 2 is to place each control that you have a custom style for in its own QML file. For example, the Qt Quick Controls button above could be moved to a file named <code>Button.qml</code> in a directory named <code>controls</code>, and used in the following manner:</p>
<pre class="cpp plain">
import "controls" as Controls
Controls.Button {
...
}
</pre>
<p>This works with both modules, and will reduce the amount of work needed when the migration begins.</p>
<a name="type-comparison-table"></a>
<h4 >Type Comparison Table</h4>
<div class="table"><table class="generic">
<thead><tr class="qt-style"><th >Qt Quick Controls 1, Qt Quick Extras</th><th >Qt Quick Controls 2, Qt Labs Calendar</th></tr></thead>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-abstractbutton.html">AbstractButton</a></td></tr>
<tr valign="top" class="even"><td >Action</td><td ><span >— <sub>(see <a href="../qtquick/qml-qtquick-shortcut.html">Shortcut</a> instead)</sub></span></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a></td><td ><a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-busyindicator.html">BusyIndicator</a></td><td ><a href="qml-qtquick-controls2-busyindicator.html">BusyIndicator</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-button.html">Button</a></td><td ><a href="qml-qtquick-controls2-button.html">Button</a></td></tr>
<tr valign="top" class="even"><td >CircularGauge</td><td >—</td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-control.html">Control</a></td></tr>
<tr valign="top" class="even"><td >—</td><td ><a href="qml-qtquick-controls2-container.html">Container</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qt-labs-calendar2-calendar.html">Calendar</a></td><td ><a href="qml-qt-labs-calendar2-monthgrid.html">MonthGrid</a>, <a href="qml-qt-labs-calendar2-dayofweekrow.html">DayOfWeekRow</a>, <a href="qml-qt-labs-calendar2-weeknumbercolumn.html">WeekNumberColumn</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-checkbox.html">CheckBox</a></td><td ><a href="qml-qtquick-controls2-checkbox.html">CheckBox</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-checkdelegate.html">CheckDelegate</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-combobox.html">ComboBox</a></td><td ><a href="qml-qtquick-controls2-combobox.html">ComboBox</a></td></tr>
<tr valign="top" class="odd"><td >DelayButton</td><td >—</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-dial.html">Dial</a></td><td ><a href="qml-qtquick-controls2-dial.html">Dial</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-drawer.html">Drawer</a></td></tr>
<tr valign="top" class="even"><td >ExclusiveGroup</td><td ><a href="qml-qtquick-controls2-buttongroup.html">ButtonGroup</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-frame.html">Frame</a></td></tr>
<tr valign="top" class="even"><td >Gauge</td><td >—</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-groupbox.html">GroupBox</a></td><td ><a href="qml-qtquick-controls2-groupbox.html">GroupBox</a></td></tr>
<tr valign="top" class="even"><td >—</td><td ><a href="qml-qtquick-controls2-itemdelegate.html">ItemDelegate</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-label.html">Label</a></td><td ><a href="qml-qtquick-controls2-label.html">Label</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-menu.html">Menu</a></td><td ><a href="qml-qtquick-controls2-menu.html">Menu</a></td></tr>
<tr valign="top" class="odd"><td >MenuBar</td><td >—</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></td><td ><a href="qml-qtquick-controls2-menuitem.html">MenuItem</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-page.html">Page</a></td></tr>
<tr valign="top" class="even"><td >—</td><td ><a href="qml-qtquick-controls2-pageindicator.html">PageIndicator</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-pane.html">Pane</a></td></tr>
<tr valign="top" class="even"><td >Picture</td><td >—</td></tr>
<tr valign="top" class="odd"><td >PieMenu</td><td >—</td></tr>
<tr valign="top" class="even"><td >—</td><td ><a href="qml-qtquick-controls2-popup.html">Popup</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-progressbar.html">ProgressBar</a></td><td ><a href="qml-qtquick-controls2-progressbar.html">ProgressBar</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-radiobutton.html">RadioButton</a></td><td ><a href="qml-qtquick-controls2-radiobutton.html">RadioButton</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-radiodelegate.html">RadioDelegate</a></td></tr>
<tr valign="top" class="even"><td >—</td><td ><a href="qml-qtquick-controls2-rangeslider.html">RangeSlider</a></td></tr>
<tr valign="top" class="odd"><td >ScrollView</td><td ><a href="qml-qtquick-controls2-scrollbar.html">ScrollBar</a>, <a href="qml-qtquick-controls2-scrollindicator.html">ScrollIndicator</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-slider.html">Slider</a></td><td ><a href="qml-qtquick-controls2-slider.html">Slider</a></td></tr>
<tr valign="top" class="odd"><td >SplitView</td><td >—</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-spinbox.html">SpinBox</a></td><td ><a href="qml-qtquick-controls2-spinbox.html">SpinBox</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-stackview.html">StackView</a>, StackViewDelegate, Stack</td><td ><a href="qml-qtquick-controls2-stackview.html">StackView</a></td></tr>
<tr valign="top" class="even"><td >StatusBar</td><td >—</td></tr>
<tr valign="top" class="odd"><td >StatusIndicator</td><td >—</td></tr>
<tr valign="top" class="even"><td >—</td><td ><a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-swipeview.html">SwipeView</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-switch.html">Switch</a></td><td ><a href="qml-qtquick-controls2-switch.html">Switch</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-switchdelegate.html">SwitchDelegate</a></td></tr>
<tr valign="top" class="even"><td >TabView, Tab</td><td ><a href="qml-qtquick-controls2-tabbar.html">TabBar</a>, <a href="qml-qtquick-controls2-tabbutton.html">TabButton</a></td></tr>
<tr valign="top" class="odd"><td >TableView</td><td >—</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-textarea.html">TextArea</a></td><td ><a href="qml-qtquick-controls2-textarea.html">TextArea</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-textfield.html">TextField</a></td><td ><a href="qml-qtquick-controls2-textfield.html">TextField</a></td></tr>
<tr valign="top" class="even"><td >ToggleButton</td><td >—</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-toolbar.html">ToolBar</a></td><td ><a href="qml-qtquick-controls2-toolbar.html">ToolBar</a></td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></td><td ><a href="qml-qtquick-controls2-toolbutton.html">ToolButton</a></td></tr>
<tr valign="top" class="odd"><td >—</td><td ><a href="qml-qtquick-controls2-tooltip.html">ToolTip</a></td></tr>
<tr valign="top" class="even"><td >TreeView</td><td >—</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-controls2-tumbler.html">Tumbler</a>, TumblerColumn</td><td ><a href="qml-qtquick-controls2-tumbler.html">Tumbler</a></td></tr>
</table></div>
<a name="related-information"></a>
<h2 id="related-information">Related Information</h2>
<ul>
<li><a href="../qtquick/qtquick-index.html">Qt Quick</a></li>
<li><a href="qtquick-controls2-qmlmodule.html">Qt Quick Controls 2 QML Types</a></li>
<li>Qt Quick Controls QML Types</li>
<li>Qt Quick Extras QML Types</li>
</ul>
</div>
<!-- @@@qtquickcontrols2-differences.html -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2016 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|