Q3ProgressBar Class

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 下載項卻無法確定要下載項的大小時。

Screenshot in Motif style Screenshot in Windows style

另請參閱 QProgressDialog and QProgressDialog .

特性文檔編製

centerIndicator : bool

This property holds whether the indicator string should be centered.

訪問函數:

bool centerIndicator () const
void setCenterIndicator (bool on )

percentageVisible : bool

This property holds whether the current progress value is displayed.

默認為 true。

訪問函數:

bool percentageVisible () const
void setPercentageVisible (bool)

另請參閱 centerIndicator .

progress : int

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 )

progressString : const QString

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

totalSteps : int

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 )

成員函數文檔編製

Q3ProgressBar:: Q3ProgressBar ( QWidget * parent = 0, Qt::WindowFlags f = 0)

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 () 構造函數。

另請參閱 setTotalSteps ().

Q3ProgressBar:: Q3ProgressBar ( int totalSteps , QWidget * parent = 0, Qt::WindowFlags f = 0)

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 () 構造函數。

另請參閱 setTotalSteps () 和 setProgress ().

[virtual protected] void Q3ProgressBar:: changeEvent ( QEvent * ev )

重實現自 QWidget::changeEvent ().

int Q3ProgressBar:: margin () const

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.

void Q3ProgressBar:: setMargin ( int margin )

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 ().