/usr/share/qt5/doc/qtquickcontrols2/qtquickcontrols2-styles.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 | <?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-styles.qdoc -->
<title>Styling Qt Quick Controls 2 | 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 >Styling Qt Quick Controls 2</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="level1"><a href="#using-styles-in-qt-quick-controls-2">Using Styles in Qt Quick Controls 2</a></li>
<li class="level2"><a href="#using-qquickstyle-in-c">Using QQuickStyle in C++</a></li>
<li class="level2"><a href="#command-line-argument">Command line argument</a></li>
<li class="level2"><a href="#environment-variable">Environment variable</a></li>
<li class="level2"><a href="#configuration-file">Configuration file</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">Styling Qt Quick Controls 2</h1>
<span class="subtitle"></span>
<!-- $$$qtquickcontrols2-styles.html-description -->
<div class="descr"> <a name="details"></a>
<p>Qt Quick Controls 2 comes with a selection of styles.</p>
<table style="background:transparent; border:0px">
<tr>
<td style="border:0px">
<a href="qtquickcontrols2-default.html">
<img src="images/qtquickcontrols2-default.png" width="45%"/>
</a>
</td>
<td style="border:0px">
<a href="qtquickcontrols2-material.html">
<img src="images/qtquickcontrols2-material.png" width="75%"/>
</a>
</td>
<td style="border:0px">
<a href="qtquickcontrols2-universal.html">
<img src="images/qtquickcontrols2-universal.png" width="75%"/>
</a>
</td>
</tr>
<tr>
<td style="border:0px">
The <a href="qtquickcontrols2-default.html">Default</a> style is
a simple and light-weight all-round style that offers the maximum
performance for Qt Quick Controls 2.
</td>
<td style="border:0px">
The <a href="qtquickcontrols2-material.html">Material</a> style offers an appealing design
based on the <a href="https://www.google.com/design/spec/material-design/introduction.html">
Google Material Design Guidelines</a>, but requires more system resources than the Default style.
</td>
<td style="border:0px">
The <a href="qtquickcontrols2-universal.html">Universal</a> style offers an appealing design
based on the <a href="https://dev.windows.com/design">Microsoft Universal Design Guidelines</a>,
but requires more system resources than the Default style.
</td>
</tr>
</table>
<a name="using-styles-in-qt-quick-controls-2"></a>
<h2 id="using-styles-in-qt-quick-controls-2">Using Styles in Qt Quick Controls 2</h2>
<p>In order to run an application with a specific style, either configure the style using <a href="qquickstyle.html">QQuickStyle</a> in C++, pass a command line argument, or set an environment variable. Alternatively, the preferred style and style-specific attributes can be specified in a configuration file.</p>
<p>The priority of these approaches follows the order they are listed below, from highest to lowest. That is, using <a href="qquickstyle.html">QQuickStyle</a> to set the style will always take priority over using the command line argument, for example.</p>
<a name="using-qquickstyle-in-c"></a>
<h3 >Using QQuickStyle in C++</h3>
<p><a href="qquickstyle.html">QQuickStyle</a> provides API for configuring a specific style. The following example runs a Qt Quick Controls 2 application with the Material style:</p>
<pre class="cpp">
<span class="preprocessor">#include <QGuiApplication></span>
<span class="preprocessor">#include <QQmlApplicationEngine></span>
<span class="preprocessor">#include <QQuickStyle></span>
<span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
{
<span class="type">QGuiApplication</span><span class="operator">::</span>setAttribute(<span class="type">Qt</span><span class="operator">::</span>AA_EnableHighDpiScaling);
<span class="type">QGuiApplication</span> app(argc<span class="operator">,</span> argv);
<span class="type">QQuickStyle</span><span class="operator">::</span>setStyle(<span class="string">"Material"</span>);
<span class="type">QQmlApplicationEngine</span> engine;
engine<span class="operator">.</span>load(<span class="type">QUrl</span>(<span class="string">"qrc:/main.qml"</span>));
<span class="keyword">return</span> app<span class="operator">.</span>exec();
}
</pre>
<a name="command-line-argument"></a>
<h3 >Command line argument</h3>
<p>Passing a <code>-style</code> command line argument is the convenient way to test different styles. It takes precedence over the other methods listed below. The following example runs a Qt Quick Controls 2 application with the Material style:</p>
<pre class="cpp">
<span class="operator">.</span><span class="operator">/</span>app <span class="operator">-</span>style material
</pre>
<a name="environment-variable"></a>
<h3 >Environment variable</h3>
<p>Setting the <code>QT_QUICK_CONTROLS_STYLE</code> environment variable can be used to set a system-wide style preference. It takes precedence over the configuration file mentioned below. The following example runs a Qt Quick Controls 2 application with the Universal style:</p>
<pre class="cpp">
QT_QUICK_CONTROLS_STYLE<span class="operator">=</span>universal <span class="operator">.</span><span class="operator">/</span>app
</pre>
<a name="configuration-file"></a>
<h3 >Configuration file</h3>
<a name="qtquickcontrols2-conf"></a><p>Qt Quick Controls 2 support a special configuration file, <code>:/qtquickcontrols2.conf</code>, that is built into an application's resources.</p>
<p>The configuration file can specify the preferred style (may be overridden by either of the methods described earlier) and certain style-specific attributes. The following example specifies that the preferred style is the Material style. Furthermore, when the application is run with the Material style, its theme is light and the accent and primary colors are teal and blue grey, respectively. However, if the application is run with the Universal style instead, the theme is dark and the accent color is red.</p>
<pre class="cpp">
<span class="operator">[</span>Controls<span class="operator">]</span>
Style<span class="operator">=</span>Material
<span class="operator">[</span>Universal<span class="operator">]</span>
Theme<span class="operator">=</span>Dark
Accent<span class="operator">=</span>Red
<span class="operator">[</span>Material<span class="operator">]</span>
Theme<span class="operator">=</span>Light
Accent<span class="operator">=</span>Teal
Primary<span class="operator">=</span>BlueGrey
</pre>
<p>In order to make it possible for Qt Quick Controls 2 to find the configuration file, it must be built into application's resources using the <a href="../qtcore/resources.html">The Qt Resource System</a>. Here's an example <code>.qrc</code> file:</p>
<pre class="cpp">
<span class="operator"><</span><span class="operator">!</span>DOCTYPE RCC<span class="operator">></span><span class="operator"><</span>RCC version<span class="operator">=</span><span class="string">"1.0"</span><span class="operator">></span>
<span class="operator"><</span>qresource prefix<span class="operator">=</span><span class="string">"/"</span><span class="operator">></span>
<span class="operator"><</span>file<span class="operator">></span>qtquickcontrols2<span class="operator">.</span>conf<span class="operator"><</span><span class="operator">/</span>file<span class="operator">></span>
<span class="operator"><</span><span class="operator">/</span>qresource<span class="operator">></span>
<span class="operator"><</span><span class="operator">/</span>RCC<span class="operator">></span>
</pre>
<p><b>Note: </b>Qt Quick Controls 2 uses a file selector to load the configuration file. It is possible to provide a different configuration file for different platforms and locales. See <a href="../qtcore/qfileselector.html">QFileSelector</a> documentation for more details.</p><p>Finally, the <code>.qrc</code> file must be listed in the application's <code>.pro</code> file so that the build system knows about it. For example:</p>
<pre class="cpp">
RESOURCES <span class="operator">=</span> application<span class="operator">.</span>qrc
</pre>
<a name="related-information"></a>
<h2 id="related-information">Related Information</h2>
<ul>
<li><a href="qtquickcontrols2-default.html">Default Style</a></li>
<li><a href="qtquickcontrols2-material.html">Material Style</a></li>
<li><a href="qtquickcontrols2-universal.html">Universal Style</a></li>
<li><a href="qtquickcontrols2-fileselectors.html">Using File Selectors with Qt Quick Controls 2</a></li>
<li><a href="qtquickcontrols2-deployment.html">Deploying Qt Quick Controls 2 Applications</a></li>
</ul>
</div>
<!-- @@@qtquickcontrols2-styles.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>
|