📄 qprogressdialog.3qt
字号:
.br t->stop();.br}.br.brvoid Operation::cancel().br{.br t->stop();.br //... cleanup.br}.fi.PPIn both modes the progress dialog may be customized by replacing the child widgets with custom widgets by using setLabel(), setBar(), and setCancelButton(). The functions setLabelText() and setCancelButtonText() set the texts shown..PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also QDialog, QProgressBar, GUI Design Handbook: Progress Indicator, and Dialog Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QProgressDialog::QProgressDialog ( QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )"Constructs a progress dialog..PPDefault settings:.TPThe label text is empty..TPThe cancel button text is (translated) "Cancel"..TPThe total number of steps is 100..PPThe \fIcreator\fR argument is the widget to use as the dialog's parent. The \fIname\fR, \fImodal\fR, and the widget flags, \fIf\fR, are passed to the QDialog::QDialog() constructor. If \fImodal\fR is FALSE (the default), you must have an event loop proceeding for any redrawing of the dialog to occur. If \fImodal\fR is TRUE, the dialog ensures that events are processed when needed..PPSee also labelText, setLabel(), setCancelButtonText(), setCancelButton(), and totalSteps..SH "QProgressDialog::QProgressDialog ( const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )"Constructs a progress dialog..PPThe \fIlabelText\fR is text used to remind the user what is progressing..PPThe \fIcancelButtonText\fR is the text to display on the cancel button, or 0 if no cancel button is to be shown..PPThe \fItotalSteps\fR is the total number of steps in the operation for which this progress dialog shows progress. For example, if the operation is to examine 50 files, this value would be 50. Before examining the first file, call setProgress(0). As each file is processed call setProgress(1), setProgress(2), etc., finally calling setProgress(50) after examining the last file..PPThe \fIcreator\fR argument is the widget to use as the dialog's parent. The \fIname\fR, \fImodal\fR, and widget flags, \fIf\fR, are passed to the QDialog::QDialog() constructor. If \fImodal\fR is FALSE (the default), you will must have an event loop proceeding for any redrawing of the dialog to occur. If \fImodal\fR is TRUE, the dialog ensures that events are processed when needed..PPSee also labelText, setLabel(), setCancelButtonText(), setCancelButton(), and totalSteps..SH "QProgressDialog::~QProgressDialog ()"Destroys the progress dialog..SH "bool QProgressDialog::autoClose () const"Returns TRUE if the dialog gets hidden by reset(); otherwise returns FALSE. See the "autoClose" property for details..SH "bool QProgressDialog::autoReset () const"Returns TRUE if the progress dialog calls reset() as soon as progress() equals totalSteps(); otherwise returns FALSE. See the "autoReset" property for details..SH "void QProgressDialog::cancel ()\fC [slot]\fR"Resets the progress dialog. wasCancelled() becomes TRUE until the progress dialog is reset. The progress dialog becomes hidden..SH "void QProgressDialog::cancelled ()\fC [signal]\fR"This signal is emitted when the cancel button is clicked. It is connected to the cancel() slot by default..PPSee also wasCancelled..PPExamples:.)l network/ftpclient/ftpmainwindow.ui.h and progress/progress.cpp..SH "void QProgressDialog::forceShow ()\fC [protected slot]\fR"Shows the dialog if it is still hidden after the algorithm has been started and minimumDuration milliseconds have passed..PPSee also minimumDuration..SH "QString QProgressDialog::labelText () const"Returns the label's text. See the "labelText" property for details..SH "int QProgressDialog::minimumDuration () const"Returns the time that the progress should run for before the dialog opens. See the "minimumDuration" property for details..SH "int QProgressDialog::progress () const"Returns the current amount of progress made. See the "progress" property for details..SH "void QProgressDialog::reset ()\fC [slot]\fR"Resets the progress dialog. The progress dialog becomes hidden if autoClose() is TRUE..PPSee also autoClose and autoReset..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QProgressDialog::setAutoClose ( bool b )"Sets whether the dialog gets hidden by reset() to \fIb\fR. See the "autoClose" property for details..SH "void QProgressDialog::setAutoReset ( bool b )"Sets whether the progress dialog calls reset() as soon as progress() equals totalSteps() to \fIb\fR. See the "autoReset" property for details..SH "void QProgressDialog::setBar ( QProgressBar * bar )"Sets the progress bar widget to \fIbar\fR. The progress dialog resizes to fit. The progress dialog takes ownership of the progress \fIbar\fR which will be deleted when necessary, so do not use a progress bar allocated on the stack..SH "void QProgressDialog::setCancelButton ( QPushButton * cancelButton )"Sets the cancel button to the push button, \fIcancelButton\fR. The progress dialog takes ownership of this button which will be deleted when necessary, so do not pass the address of an object that is on the stack, i.e. use new() to create the button..PPSee also setCancelButtonText()..SH "void QProgressDialog::setCancelButtonText ( const QString & cancelButtonText )\fC [slot]\fR"Sets the cancel button's text to \fIcancelButtonText\fR..PPSee also setCancelButton()..SH "void QProgressDialog::setLabel ( QLabel * label )"Sets the label to \fIlabel\fR. The progress dialog resizes to fit. The label becomes owned by the progress dialog and will be deleted when necessary, so do not pass the address of an object on the stack..PPSee also labelText..PPExample: progress/progress.cpp..SH "void QProgressDialog::setLabelText ( const QString & )\fC [slot]\fR"Sets the label's text. See the "labelText" property for details..SH "void QProgressDialog::setMinimumDuration ( int ms )\fC [slot]\fR"Sets the time that the progress should run for before the dialog opens to \fIms\fR. See the "minimumDuration" property for details..SH "void QProgressDialog::setProgress ( int progress )\fC [slot]\fR"Sets the current amount of progress made to \fIprogress\fR. See the "progress" property for details..SH "void QProgressDialog::setProgress ( int progress, int totalSteps )\fC [slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the current amount of progress to \fIprogress\fR and the total number of steps to \fItotalSteps\fR..PPSee also totalSteps..SH "void QProgressDialog::setTotalSteps ( int totalSteps )\fC [slot]\fR"Sets the total number of steps to \fItotalSteps\fR. See the "totalSteps" property for details..SH "QSize QProgressDialog::sizeHint () const\fC [virtual]\fR"Returns a size that fits the contents of the progress dialog. The progress dialog resizes itself as required, so you should not need to call this yourself..SH "int QProgressDialog::totalSteps () const"Returns the total number of steps. See the "totalSteps" property for details..SH "bool QProgressDialog::wasCancelled () const"Returns TRUE if the dialog was cancelled; otherwise returns FALSE. See the "wasCancelled" property for details..SS "Property Documentation".SH "bool autoClose"This property holds whether the dialog gets hidden by reset()..PPThe default is TRUE..PPSee also autoReset..PPSet this property's value with setAutoClose() and get this property's value with autoClose()..SH "bool autoReset"This property holds whether the progress dialog calls reset() as soon as progress() equals totalSteps()..PPThe default is TRUE..PPSee also autoClose..PPSet this property's value with setAutoReset() and get this property's value with autoReset()..SH "QString labelText"This property holds the label's text..PPThe default text is QString::null..PPSet this property's value with setLabelText() and get this property's value with labelText()..SH "int minimumDuration"This property holds the time that the progress should run for before the dialog opens..PPThe dialog will not appear if the expected duration of the progressing task is less than the minimum duration..PPIf set to 0, the dialog is always shown as soon as any progress is set. The default is 4000 milliseconds..PPSet this property's value with setMinimumDuration() and get this property's value with minimumDuration()..SH "int progress"This property holds the current amount of progress made..PPFor the progress dialog to work as expected, you should initially set this property to 0 and finally set it to QProgressDialog::totalSteps(); you can call setProgress() any number of times in-between..PP\fBWarning:\fR If the progress dialog is modal (see QProgressDialog::QProgressDialog()), this function calls QApplication::processEvents(), so take care that this does not cause undesirable re-entrancy in your code. For example, don't use a QProgressDialog inside a paintEvent()!.PPSee also totalSteps..PPSet this property's value with setProgress() and get this property's value with progress()..SH "int totalSteps"This property holds the total number of steps..PPThe default is 0..PPSet this property's value with setTotalSteps() and get this property's value with totalSteps()..SH "bool wasCancelled"This property holds whether the dialog was cancelled..PPGet this property's value with wasCancelled()..PPSee also progress..SH "SEE ALSO".BR http://doc.trolltech.com/qprogressdialog.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qprogressdialog.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -