43 #ifndef QT_NO_PROGRESSBAR 48 #include <private/qwidget_p.h> 49 #ifndef QT_NO_ACCESSIBILITY 76 inline int bound(
int val)
const {
return qMax(minimum-1,
qMin(maximum, val)); }
102 q->initStyleOption(&option);
132 = qstyleoption_cast<QStyleOptionProgressBarV2 *>(option)) {
133 optionV2->orientation =
d->orientation;
134 optionV2->invertedAppearance =
d->invertedAppearance;
160 q->initStyleOption(&opt);
167 return (valueDifference * grooveBlock > cw * (
maximum -
minimum));
264 d->value =
d->minimum - 1;
265 if (
d->minimum == INT_MIN)
289 return d_func()->minimum;
313 return d_func()->maximum;
329 if (
d->value == value
330 || ((value >
d->maximum || value < d->
minimum)
331 && (
d->maximum != 0 ||
d->minimum != 0)))
335 #ifndef QT_NO_ACCESSIBILITY 339 if (
d->repaintRequired())
345 return d_func()->value;
363 if (minimum !=
d->minimum || maximum !=
d->maximum) {
365 d->maximum =
qMax(minimum, maximum);
367 if (
d->value < (
d->minimum - 1) ||
d->value >
d->maximum)
388 if (
d->textVisible != visible) {
396 return d_func()->textVisible;
408 if (d_func()->alignment != alignment) {
416 return d_func()->alignment;
428 d_func()->lastPaintedValue = d_func()->value;
481 if ((
d->maximum == 0 &&
d->minimum == 0) ||
d->value <
d->minimum
482 || (
d->value == INT_MIN &&
d->minimum == INT_MIN))
494 if (totalSteps == 0) {
499 int progress = (
qreal(
d->value) -
d->minimum) *
qreal(100.0) / totalSteps;
520 if (
d->orientation == orientation)
529 d->resetLayoutItemMargins();
537 return d->orientation;
558 d->invertedAppearance = invert;
565 return d->invertedAppearance;
591 return d->textDirection;
603 d->resetLayoutItemMargins();
626 if (
d->format == format)
640 #endif // QT_NO_PROGRESSBAR static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setTextVisible(bool visible)
void setOrientation(Qt::Orientation)
QString text
the text for the progress bar
Qt::Orientation orientation() const
Direction
Specifies the reading direction of the text for vertical progress bars.
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
int maximum
the maximum value for the progress bar
void drawControl(QStyle::ControlElement ce, const QStyleOption &opt)
Use the widget's style to draw a control element ce specified by QStyleOption option.
QStyle::State state
the style flags that are used when drawing the control
Qt::Alignment alignment() const
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QString & replace(int i, int len, QChar after)
Qt::Orientation orientation
the progress bar's orientation (horizontal or vertical); the default orentation is Qt::Horizontal ...
int width() const
Returns the width of the rectangle.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QSize sizeHint() const
Reimplemented Function
QProgressBar::Direction textDirection
The QProgressBar widget provides a horizontal or vertical progress bar.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
Q_DECL_CONSTEXPR T qAbs(const T &t)
bool event(QEvent *e)
Reimplemented Function
QProgressBar(QWidget *parent=0)
Constructs a progress bar with the given parent.
void setFormat(const QString &format)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void initStyleOption(QStyleOptionProgressBar *option) const
Initialize option with the values from this QProgressBar.
void setMaximum(int maximum)
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
#define QT_BEGIN_NAMESPACE
This macro expands to.
void resetLayoutItemMargins()
void initFrom(const QWidget *w)
void setInvertedAppearance(bool invert)
int progress
the current progress for the progress bar
void transpose()
Swaps the width and height values.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Qt::Alignment textAlignment
the text alignment for the text in the QProgressBar
void setTextDirection(QProgressBar::Direction textDirection)
int minimum
the minimum value for the progress bar
bool repaintRequired() const
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=0) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
void setRange(int minimum, int maximum)
Sets the progress bar's minimum and maximum values to minimum and maximum respectively.
bool textVisible
a flag indicating whether or not text is visible
void paintEvent(QPaintEvent *)
Reimplemented Function
void setMinimum(int minimum)
#define Q_DECLARE_PUBLIC(Class)
bool invertedAppearance()
The QRect class defines a rectangle in the plane using integer precision.
QProgressBar::Direction textDirection()
QSize minimumSizeHint() const
Reimplemented Function
bool isTextVisible() const
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget...
The QSize class defines the size of a two-dimensional object using integer point precision.
void reset()
Reset the progress bar.
Qt::Orientation orientation
The QStyleOptionProgressBar class is used to describe the parameters necessary for drawing a progress...
int height() const
Returns the height of the font.
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
void setAlignment(Qt::Alignment alignment)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void valueChanged(int value)
This signal is emitted when the value shown in the progress bar changes.
virtual QString text() const