Sophie

Sophie

distrib > Mageia > 6 > i586 > by-pkgid > f93881942bd3805980c2fe63aa853d78 > files > 241

qtdoc5-5.9.4-1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- styling.qdoc -->
  <title>Use Case - Style And Theme Support | Qt 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.9</a></td><td >Use Case - Style And Theme Support</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 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-the-styling-qml-types">Using the Styling QML Types</a></li>
<li class="level1"><a href="#accessing-the-system-palette">Accessing the System Palette</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Use Case - Style And Theme Support</h1>
<span class="subtitle"></span>
<!-- $$$qtquick-usecase-styling.html-description -->
<div class="descr"> <a name="details"></a>
<p>Styling with QML involves creating a visual type and binding that to a property or by directly assigning a value to a property. For types that incorporate Qt Quick's delegates the visual type attaches to the <i>delegate</i> property.</p>
<p>When using Qt Quick Controls, the controls automatically set the appropriate style from the respective <a href="supported-platforms.html">platforms</a>.</p>
<a name="using-the-styling-qml-types"></a>
<h2 id="using-the-styling-qml-types">Using the Styling QML Types</h2>
<p>The controls have a <code>style</code> property to which the <i>styling types</i> bind. The controls have a corresponding styling type from the Qt Quick Controls Styles module. For example, Button has a ButtonStyle type and Menu has a MenuStyle type. The styling types provide properties applicable to their respective controls such as the background, label, or for some controls, the cursor appearance.</p>
<pre class="qml">

  <span class="type">Button</span> {
      <span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">&quot;Hello World&quot;</span>)
      <span class="name">style</span>: <span class="name">ButtonStyle</span> {
          <span class="name">background</span>: <span class="name">Rectangle</span> {
              <span class="name">implicitWidth</span>: <span class="number">100</span>
              <span class="name">implicitHeight</span>: <span class="number">25</span>
              <span class="name">border</span>.width: <span class="name">control</span>.<span class="name">activeFocus</span> ? <span class="number">2</span> : <span class="number">1</span>
              <span class="name">border</span>.color: <span class="string">&quot;#FFF&quot;</span>
              <span class="name">radius</span>: <span class="number">4</span>
              <span class="name">gradient</span>: <span class="name">Gradient</span> {
                  <span class="type">GradientStop</span> { <span class="name">position</span>: <span class="number">0</span> ; <span class="name">color</span>: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#ccc&quot;</span> : <span class="string">&quot;#fff&quot;</span> }
                  <span class="type">GradientStop</span> { <span class="name">position</span>: <span class="number">1</span> ; <span class="name">color</span>: <span class="name">control</span>.<span class="name">pressed</span> ? <span class="string">&quot;#000&quot;</span> : <span class="string">&quot;#fff&quot;</span> }
              }
          }
     }

</pre>
<p><b>Note: </b>Qt Quick Controls Styles was introduced in Qt 5.1 and requires Qt Quick 2.1&#x2e;</p><a name="accessing-the-system-palette"></a>
<h2 id="accessing-the-system-palette">Accessing the System Palette</h2>
<p>The SystemPalette type provides information about the system's palette information. QML applications can use this information to set the appearance of visual types to match the native look-and-feel. In addition, on <a href="supported-platforms.html#desktop-platforms">desktop</a> platforms, different color palettes are employed when changing states, for example, when the application loses keyboard focus.</p>
<p>When using the controls, the system colors are already used.</p>
</div>
<!-- @@@qtquick-usecase-styling.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 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>