Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickprogressbar.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include "qquickcontrol_p_p.h"
6
8
13
57{
58public:
60 qreal to = 1;
62 bool indeterminate = false;
63};
64
71
80{
81 Q_D(const QQuickProgressBar);
82 return d->from;
83}
84
86{
88 if (qFuzzyCompare(d->from, from))
89 return;
90
91 d->from = from;
96 setValue(d->value);
97}
98
107{
108 Q_D(const QQuickProgressBar);
109 return d->to;
110}
111
113{
115 if (qFuzzyCompare(d->to, to))
116 return;
117
118 d->to = to;
119 emit toChanged();
123 setValue(d->value);
124}
125
134{
135 Q_D(const QQuickProgressBar);
136 return d->value;
137}
138
140{
143 value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
144
145 if (qFuzzyCompare(d->value, value))
146 return;
147
148 d->value = value;
152}
153
167{
168 Q_D(const QQuickProgressBar);
169 if (qFuzzyCompare(d->from, d->to))
170 return 0;
171 return (d->value - d->from) / (d->to - d->from);
172}
173
188{
189 if (isMirrored())
190 return 1.0 - position();
191 return position();
192}
193
204{
205 Q_D(const QQuickProgressBar);
206 return d->indeterminate;
207}
208
210{
212 if (d->indeterminate == indeterminate)
213 return;
214
215 d->indeterminate = indeterminate;
217}
218
225
232
233#if QT_CONFIG(accessibility)
234QAccessible::Role QQuickProgressBar::accessibleRole() const
235{
236 return QAccessible::ProgressBar;
237}
238#endif
239
241
242#include "moc_qquickprogressbar_p.cpp"
static constexpr Policy Preferred
static constexpr Policy Fixed
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
bool isMirrored() const
\qmlproperty bool QtQuick.Controls::Control::mirrored \readonly
virtual void mirrorChange()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
Indicates the progress of an operation.
void indeterminateChanged()
void visualPositionChanged()
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void mirrorChange() override
void setIndeterminate(bool indeterminate)
QQuickProgressBar(QQuickItem *parent=nullptr)
void setValue(qreal value)
void setFrom(qreal from)
bool isIndeterminate() const
\qmlproperty bool QtQuick.Controls::ProgressBar::indeterminate
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:44
#define emit
double qreal
Definition qtypes.h:187