Qt:Документация 4.3.2/qprogressbar

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QProgressBar Class Reference
[модуль QtGui ]

The QProgressBar widget provides a horizontal or vertical progress bar. More...

 #include <QProgressBar>

Inherits QWidget.

[править] Открытые типы

[править] Свойства

  • 56 свойства унаследованных от QWidget
  • 1 свойство унаследованное от QObject

[править] Открытые функции

  • 201 открытых функций унаследованных от QWidget
  • 29 открытых функций унаследованных от QObject
  • 12 открытых функций унаследованных от QPaintDevice

[править] Открытые слоты

  • 19 открытых слотов унаследованных от QWidget
  • 1 открытый слот унаследованный от QObject

[править] Сигналы

  • 1 сигнал унаследованный от QWidget
  • 1 сигнал унаследованный от QObject

[править] Защищенные функции

  • 38 защищенных функций унаследованных от QWidget
  • 7 защищенных функций унаследованных от QObject
  • 1 защищенная функция унаследованна от QPaintDevice

[править] Дополнительные унаследованные члены

  • 4 статических открытых члена унаследованных от QWidget
  • 5 статических открытых члена унаследованных от QObject
  • 1 защищенный слот унаследованный от QWidget

[править] Подробное описание

The QProgressBar widget provides a horizontal or vertical progress bar.

A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application is still running.

The progress bar uses the concept of steps. You set it up by specifying the minimum and maximum possible step values, and it will display the percentage of steps that have been completed when you later give it the current step value. The percentage is calculated by dividing the progress ( value() - minimum()) divided by maximum() - minimum().

You can specify the minimum and maximum number of steps with setMinimum() and setMaximum. The current number of steps is set with setValue(). The progress bar can be rewound to the beginning with reset().

If minimum and maximum both are set to 0, the bar shows a busy indicator instead of a percentage of steps. This is useful, for example, when using QFtp or QHttp to download items when they are unable to determine the size of the item being downloaded.


center A progress bar shown in the Macintosh widget style.
center A progress bar shown in the Windows XP widget style.
Файл:Plastique-progressbar.png A progress bar shown in the Plastique widget style.

See also QTimeLine, QProgressDialog, and GUI Design Handbook: Progress Indicator.


[править] Описание типов членов

[править]
enum QProgressBar::Direction

Specifies the reading direction of the text for vertical progress bars.


Constant Value Description
QProgressBar::TopToBottom 0 The text is rotated 90 degrees clockwise.
QProgressBar::BottomToTop 1 The text is rotated 90 degrees counter-clockwise.

Note that whether or not the text is drawn is dependent on the style. Currently CDE, CleanLooks, Motif, and Plastique draw the text. Mac, Windows and WindowsXP style do not.

This enum was introduced in Qt 4.1.

See also textDirection.


[править] Описание свойств

[править]
alignment : Qt::Alignment

This property holds the alignment of the progress bar.

Функции доступа:

  • Qt::Alignment alignment () const
  • void setAlignment ( Qt::Alignment alignment )

[править]
format : QString

This property holds the string used to generate the current text.

%p - is replaced by the percentage completed. %v - is replaced by the current value. %m - is replaced by the total number of steps.

The default value is "%p%".

This property was introduced in Qt 4.2.

Функции доступа:

  • QString format () const
  • void setFormat ( const QString & format )

See also text().

[править]
invertedAppearance : bool

This property holds whether or not a progress bar shows its progress inverted.

If this property is false, the progress bar grows in the other direction (e.g. from right to left). By default, the progress bar is not inverted.

This property was introduced in Qt 4.1.

Функции доступа:

  • bool invertedAppearance ()
  • void setInvertedAppearance ( bool invert )

See also orientation and layoutDirection.

[править]
maximum : int

This property holds the progress bar's maximum value.

When setting this property, the minimum is adjusted if necessary to ensure that the range remains valid. If the current value falls outside the new range, the progress bar is reset with reset().

Функции доступа:

  • int maximum () const
  • void setMaximum ( int maximum )

[править]
minimum : int

This property holds the progress bar's minimum value.

When setting this property, the maximum is adjusted if necessary to ensure that the range remains valid. If the current value falls outside the new range, the progress bar is reset with reset().

Функции доступа:

  • int minimum () const
  • void setMinimum ( int minimum )

[править]
orientation : Qt::Orientation

This property holds the orientation of the progress bar.

The orientation must be Qt::Horizontal (the default) or Qt::Vertical.

This property was introduced in Qt 4.1.

Функции доступа:

  • Qt::Orientation orientation () const
  • void setOrientation ( Qt::Orientation )

See also invertedAppearance and textDirection.

[править]
text : const QString

This property holds the descriptive text shown with the progress bar.

The text returned is the same as the text displayed in the center (or in some styles, to the left) of the progress bar.

The progress shown in the text may be smaller than the minimum value, indicating that the progress bar is in the "reset" state before any progress is set.

In the default implementation, the text either contains a percentage value that indicates the progress so far, or it is blank because the progress bar is in the reset state.

Функции доступа:

  • virtual QString text () const

[править]
textDirection : Direction

This property holds the reading direction of the text for vertical progress bars.

This property has no impact on horizontal progress bars. By default, the reading direction is QProgressBar::TopToBottom.

This property was introduced in Qt 4.1.

Функции доступа:

  • QProgressBar::Direction textDirection ()
  • void setTextDirection ( QProgressBar::Direction textDirection )

See also orientation and textVisible.

[править]
textVisible : bool

This property holds whether the current completed percentage should be displayed.

Функции доступа:

  • bool isTextVisible () const
  • void setTextVisible ( bool visible )

See also textDirection.

[править]
value : int

This property holds the progress bar's current value.

Attempting to change the current value to one outside the minimum-maximum range has no effect on the current value.

Функции доступа:

  • int value () const
  • void setValue ( int value )

[править] Описание функций-членов

[править]
QProgressBar::QProgressBar ( QWidget * parent = 0 )

Constructs a progress bar with the given parent.

By default, the minimum step value is set to 0, and the maximum to 100.

See also setRange().

[править]
void QProgressBar::initStyleOption ( QStyleOptionProgressBar * option ) const [protected]

Initialize option with the values from this QProgressBar. This method is useful for subclasses when they need a QStyleOptionProgressBar or QStyleOptionProgressBarV2, but don't want to fill in all the information themselves. This function will check the version of the QStyleOptionProgressBar and fill in the additional values for a QStyleOptionProgressBarV2.

See also QStyleOption::initFrom().

[править]
void QProgressBar::reset () [slot]

Reset the progress bar. The progress bar "rewinds" and shows no progress.

[править]
void QProgressBar::setRange ( int minimum, int maximum ) [slot]

Sets the progress bar's minimum and maximum values to minimum and maximum respectively.

If maximum is smaller than minimum, minimum becomes the only legal value.

If the current value falls outside the new range, the progress bar is reset with reset().

See also minimum and maximum.

[править]
void QProgressBar::valueChanged ( int value ) [signal]

This signal is emitted when the value shown in the progress bar changes. value is the new value shown by the progress bar.


Copyright © 2007 Trolltech Trademarks
Qt 4.3.2