The Q3ProgressBar widget provides a horizontal progress bar. 更多...
| 头: | #include <Q3ProgressBar> |
| 继承: | QFrame |
|
|
| Q3ProgressBar (QWidget * parent = 0, Qt::WindowFlags f = 0) | |
| Q3ProgressBar (int totalSteps , QWidget * parent = 0, Qt::WindowFlags f = 0) | |
| bool | centerIndicator () const |
| int | margin () const |
| bool | percentageVisible () const |
| int | progress () const |
| const QString & | progressString () const |
| void | setCenterIndicator (bool on ) |
| void | setMargin (int margin ) |
| void | setPercentageVisible (bool) |
| int | totalSteps () const |
| virtual QSize | minimumSizeHint () const |
| virtual void | setVisible (bool visible ) |
| virtual QSize | sizeHint () const |
| void | reset () |
| virtual void | setProgress (int progress ) |
| void | setProgress (int progress , int totalSteps ) |
| virtual void | setTotalSteps (int totalSteps ) |
| virtual bool | setIndicator (QString & indicator , int progress , int totalSteps ) |
| virtual void | changeEvent (QEvent * ev ) |
| virtual void | paintEvent (QPaintEvent *) |
The Q3ProgressBar widget provides a horizontal progress bar.
进度条用于为用户给出操作进度指示,并安慰用户应用程序仍在运行。
The progress bar uses the concept of steps ; you give it the total number of steps and the number of steps completed so far and it will display the percentage of steps that have been completed. You can specify the total number of steps in the constructor or later with setTotalSteps (). The current number of steps is set with setProgress ()。可以把进度条倒带到起始采用 reset ().
If the total is given as 0 the progress bar shows a busy indicator instead of a percentage of steps. This is useful, for example, when using QFtp or QHttp 下载项却无法确定要下载项的大小时。
另请参阅 QProgressDialog and QProgressDialog .
This property holds whether the indicator string should be centered.
访问函数:
| bool | centerIndicator () const |
| void | setCenterIndicator (bool on ) |
This property holds whether the current progress value is displayed.
默认为 true。
访问函数:
| bool | percentageVisible () const |
| void | setPercentageVisible (bool) |
另请参阅 centerIndicator .
This property holds the current amount of progress.
This property is -1 if progress counting has not started.
访问函数:
| int | progress () const |
| virtual void | setProgress (int progress ) |
| void | setProgress (int progress , int totalSteps ) |
This property holds the amount of progress as a string.
This property is an empty string if progress counting has not started.
访问函数:
| const QString & | progressString () const |
This property holds the total number of steps.
If totalSteps is 0, the progress bar will display a busy indicator.
访问函数:
| int | totalSteps () const |
| virtual void | setTotalSteps (int totalSteps ) |
Constructs a progress bar.
The total number of steps is set to 100 by default.
The parent , and widget flags, f , are passed on to the QFrame::QFrame () constructor.
另请参阅 setTotalSteps ().
Constructs a progress bar.
The totalSteps is the total number of steps that need to be completed for the operation which this progress bar represents. For example, if the operation is to examine 50 files, this value would be 50. Before examining the first file, call setProgress (0); call setProgress (50) after examining the last file.
The parent , and widget flags, f , are passed to the QFrame::QFrame () constructor.
另请参阅 setTotalSteps () 和 setProgress ().
[virtual protected]
void
Q3ProgressBar::
changeEvent
(
QEvent
*
ev
)
重实现自 QWidget::changeEvent ().
Returns the width of the margin around the contents of the widget.
此函数使用 QWidget::getContentsMargins () to get the margin.
该函数在 Qt 4.2 引入。
另请参阅 setMargin () 和 QWidget::getContentsMargins ().
[虚拟]
QSize
Q3ProgressBar::
minimumSizeHint
() const
重实现自 QWidget::minimumSizeHint ().
[virtual protected]
void
Q3ProgressBar::
paintEvent
(
QPaintEvent
*)
重实现自 QWidget::paintEvent ().
[slot]
void
Q3ProgressBar::
reset
()
重置进度条。进度条倒带且不展示进度。
[virtual protected]
bool
Q3ProgressBar::
setIndicator
(
QString
&
indicator
,
int
progress
,
int
totalSteps
)
This method is called to generate the text displayed in the center (or in some styles, to the left) of the progress bar.
The progress may be negative, indicating that the progress bar is in the "reset" state before any progress is set.
The default implementation is the percentage of completion or blank in the reset state. The percentage is calculated based on the progress and totalSteps . You can set the indicator text if you wish.
To allow efficient repainting of the progress bar, this method should return false if the string is unchanged from the last call to this function.
Sets the width of the margin around the contents of the widget to margin .
此函数使用 QWidget::setContentsMargins () to set the margin.
该函数在 Qt 4.2 引入。
另请参阅 margin () 和 QWidget::setContentsMargins ().
[虚拟]
void
Q3ProgressBar::
setVisible
(
bool
visible
)
重实现自 QWidget::setVisible ().
[虚拟]
QSize
Q3ProgressBar::
sizeHint
() const
重实现自 QWidget::sizeHint ().