<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- examples.qdoc -->
  <meta name="description" content="Example for documenting QML types.">
  <title>QML Documentation Example | Qt 6.2.11</title>
</head>
<body>
<h1 class="title">QML Documentation Example</h1>
<pre class="qml" translate="no"><span class="comment">// Copyright (C) 2016 The Qt Company Ltd.</span>
<span class="comment">// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause</span>

import QtQuick 1.0

<span class="comment">/*!
    \qmltype ProgressBar
    \inqmlmodule UIComponents
    \brief A component that shows the progress of an event.

    A ProgressBar shows the linear progress of an event as its \l value.
    The range is specified using the \l {minimum} and the \l{maximum} values.

    The ProgressBar component is part of the \l {UI Components} module.

    This documentation is part of the \l{componentset}{UIComponents} example.
*/</span>
<span class="type">Item</span> {
    <span class="name">id</span>: <span class="name">progressbar</span>

    <span class="comment">/*!
        The minimum value of the ProgressBar range.
        The \l value must not be less than this value.
    */</span>
    property <span class="type"><a href="qml-int.html" translate="no">int</a></span> <span class="name">minimum</span>: <span class="number">0</span>

    <span class="comment">/*!
        The maximum value of the ProgressBar range.
        The \l value must not be more than this value.
    */</span>
    property <span class="type"><a href="qml-int.html" translate="no">int</a></span> <span class="name">maximum</span>: <span class="number">100</span>

    <span class="comment">/*!
        The value of the progress.
    */</span>
    property <span class="type"><a href="qml-int.html" translate="no">int</a></span> <span class="name">value</span>: <span class="number">0</span>

    <span class="comment">/*!
       \qmlproperty color ProgressBar::color
       The color of the ProgressBar's gradient. Must bind to a color type.

       \omit
           The &quot;\qmlproperty &lt;type&gt; &lt;property name&gt;&quot; is needed because
           property alias need to have their types manually entered.

           QDoc will not publish the documentation within omit and endomit.
       \endomit

       \sa secondColor
    */</span>
    property <span class="type">alias</span> <span class="name">color</span>: <span class="name">gradient1</span>.<span class="name">color</span>

    <span class="comment">/*!
       \qmlproperty color ProgressBar::secondColor
       The second color of the ProgressBar's gradient.
       Must bind to a color type.

       \omit
           The &quot;\qmlproperty &lt;type&gt; &lt;property name&gt;&quot; is needed because
           property alias need to have their types manually entered.

           QDoc will not publish the documentation within omit and endomit.
       \endomit

        \sa color
    */</span>
    property <span class="type">alias</span> <span class="name">secondColor</span>: <span class="name">gradient2</span>.<span class="name">color</span>

    <span class="name">width</span>: <span class="number">250</span>; <span class="name">height</span>: <span class="number">23</span>
    <span class="name">clip</span>: <span class="number">true</span>

    <span class="type">Rectangle</span> {
        <span class="name">id</span>: <span class="name">highlight</span>

        <span class="comment">/*!
            An internal documentation comment. The widthDest property is not
            a public API and therefore will not be exposed.
        */</span>
        property <span class="type"><a href="qml-int.html" translate="no">int</a></span> <span class="name">widthDest</span>: ((<span class="name">progressbar</span>.<span class="name">width</span> <span class="operator">*</span> (<span class="name">value</span> <span class="operator">-</span> <span class="name">minimum</span>)) <span class="operator">/</span> (<span class="name">maximum</span> <span class="operator">-</span> <span class="name">minimum</span>) <span class="operator">-</span> <span class="number">6</span>)

        <span class="name">width</span>: <span class="name">highlight</span>.<span class="name">widthDest</span>
        Behavior on <span class="name">width</span> { <span class="type">SmoothedAnimation</span> { <span class="name">velocity</span>: <span class="number">1200</span> } }

        <span class="type">anchors</span> { <span class="name">left</span>: <span class="name">parent</span>.<span class="name">left</span>; <span class="name">top</span>: <span class="name">parent</span>.<span class="name">top</span>; <span class="name">bottom</span>: <span class="name">parent</span>.<span class="name">bottom</span>; <span class="name">margins</span>: <span class="number">3</span> }
        <span class="name">radius</span>: <span class="number">1</span>
        <span class="name">gradient</span>: <span class="name">Gradient</span> {
            <span class="type">GradientStop</span> { <span class="name">id</span>: <span class="name">gradient1</span>; <span class="name">position</span>: <span class="number">0.0</span> }
            <span class="type">GradientStop</span> { <span class="name">id</span>: <span class="name">gradient2</span>; <span class="name">position</span>: <span class="number">1.0</span> }
        }

    }
    <span class="type">Text</span> {
        <span class="type">anchors</span> { <span class="name">right</span>: <span class="name">highlight</span>.<span class="name">right</span>; <span class="name">rightMargin</span>: <span class="number">6</span>; <span class="name">verticalCenter</span>: <span class="name">parent</span>.<span class="name">verticalCenter</span> }
        <span class="name">color</span>: <span class="string">&quot;white&quot;</span>
        <span class="name">font</span>.bold: <span class="number">true</span>
        <span class="name">text</span>: <span class="name">Math</span>.<span class="name">floor</span>((<span class="name">value</span> <span class="operator">-</span> <span class="name">minimum</span>) <span class="operator">/</span> (<span class="name">maximum</span> <span class="operator">-</span> <span class="name">minimum</span>) <span class="operator">*</span> <span class="number">100</span>) <span class="operator">+</span> <span class="string">'%'</span>
    }
}</pre>
