📄 qdialog.3qt
字号:
'\" t.TH QDialog 3qt "5 August 2004" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQDialog \- The base class of dialog windows.br.PP\fC#include <qdialog.h>\fR.PPInherits QWidget..PPInherited by QColorDialog, QFileDialog, QFontDialog, QInputDialog, QMessageBox, QPrintDialog, QTabDialog and QWizard..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQDialog\fR ( QWidget * " "parent" "=0, const char * " "name" "=0, bool " "modal" "=FALSE, WFlags " "f" "=0 ) ".br.ti -1c.BI "\fB~QDialog\fR () ".br.ti -1c.BI "enum \fBDialogCode\fR { Rejected, Accepted }".br.ti -1c.BI "int \fBexec\fR () ".br.ti -1c.BI "int \fBresult\fR () const".br.ti -1c.BI "virtual void \fBshow\fR () ".br.ti -1c.BI "void \fBsetOrientation\fR ( Orientation orientation ) ".br.ti -1c.BI "Orientation \fBorientation\fR () const".br.ti -1c.BI "void \fBsetExtension\fR ( QWidget * extension ) ".br.ti -1c.BI "QWidget* \fBextension\fR () const".br.ti -1c.BI "void \fBsetSizeGripEnabled\fR ( bool ) ".br.ti -1c.BI "bool \fBisSizeGripEnabled\fR () const".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetResult\fR ( int r ) ".br.in -1c.SS "Protected Slots".in +1c.ti -1c.BI "virtual void \fBdone\fR ( int ) ".br.ti -1c.BI "virtual void \fBaccept\fR () ".br.ti -1c.BI "virtual void \fBreject\fR () ".br.ti -1c.BI "void \fBshowExtension\fR ( bool ) ".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE Optionsbool sizeGripEnabled isSizeGripEnabled setSizeGripEnabled.TE.fi.SH DESCRIPTIONThe QDialog class is the base class of dialog windows..PPA dialog window is a top-level window used for short-term tasks and brief communications with the user. QDialog offers mechanisms such as modality, default buttons, extensibility and a result value..PPModality means that the dialog blocks input to other windows: The user \fIhas\fR to finish interacting with the dialog and close it before resuming work with the other window(s). The only way to set modality is by using the constructor, and the default is modelessness. For modal dialog, it's generally better to call exec() than show; exec() returns when the dialog has been closed and has a useful return value (see below)..PPThe default button is the button that's pressed when the user presses Enter or Return, to accept the things done using this dialog and close it. QDialog uses QPushButton::autoDefault(), QPushButton::isDefault() and QPushButton::setDefault() to make Enter or Return map to the right button at any time..PPExtensibility is the ability to show more or less of the dialog. Typically, the dialog starts out small, has a "More" button, and when the user clicks "More", the dialog becomes bigger, and shows some less-used options. QDialog supports this using setExtension(), setOrientation() and showExtension()..PPSince dialogs typically tend to have result value (pressing Enter/Return maps to one value and pressing Escape to the other), QDialog supports that. A dialog can finish by calling the slots accept() or reject(), and exec() returns that result..PPNote that QDialog uses the parent widget a bit differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is on top of the parent, it shares taskbar entry with its parent, and there are some minor details..PPQDialog also can provide a QSizeGrip in its lower-right corner. If you want that, call setSizeGripEnabled( TRUE )..PPSee also QTabDialog, QWidget, QSemiModal and GUI Design Handbook: Dialogs, Standard..PPExamples:.(li18n/main.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QDialog::QDialog ( QWidget * parent=0, const char * name=0, bool modal=FALSE, WFlags f=0 )"Constructs a dialog named \fIname,\fR which has a parent widget \fIparent.\fR.PPThe dialog is modal (blocks input to other windows) if \fImodal\fR is TRUE, and modeless if \fImodal\fR is FALSE (this is the default)..PPThe widget flags \fIf\fR are sent to the QWidget constructor, as usual..PPIf you e.g. don't want a What's this button in the titlebar of the dialog, pass WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu here..PPWe recommend always passing a parent..PPSee also QWidget::setWFlags and Qt::WidgetFlags..SH "QDialog::~QDialog ()"Destructs the QDialog, deleting all its children..SH "void QDialog::accept () \fC[virtual protected slot]\fR"Hides the dialog and sets the result code to \fCAccepted.\fR.SH "void QDialog::closeEvent ( QCloseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QDialog::done ( int r ) \fC[virtual protected slot]\fR"Hides the (modal) dialog and sets its result code to \fIr.\fR This uses the local event loop to finish and exec() to return \fIr.\fR.PPIf the dialog has the \fCWDestructiveClose\fR flag set, done() also deletes the dialog. If the dialog is the applications's main widget, the application quits..PPSee also accept(), reject(), QApplication::mainWidget() and QApplication::quit()..PPReimplemented in QFileDialog..SH "int QDialog::exec ()"Starts the (modal) dialog, waits, and returns the result code when it is done..PPIf the dialog is modeless, the behaviour of this function is undefined..PPSee also show() and result()..PPExamples:.(lwizard/main.cpp i18n/main.cpp.)l.SH "QWidget* QDialog::extension () const"Returns the dialog's extension or 0 if no extension has been defined..PPSee also setExtension()..SH "void QDialog::hide () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "bool QDialog::isSizeGripEnabled () const"Returns TRUE if the QDialog has a QSizeGrip in the bottom right of the dialog, and FALSE if it does not..PPSee also setSizeGripEnabled()..SH "void QDialog::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSize QDialog::minimumSizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QDialog::move ( const QPoint & p )"Reimplemented for internal reasons; the API is not affected..SH "void QDialog::move ( int x, int y ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "Qt::Orientation QDialog::orientation() const"Returns the extension direction of the dialog..PPSee also setOrientation()..SH "void QDialog::reject () \fC[virtual protected slot]\fR"Hides the dialog and sets the result code to \fCRejected.\fR.SH "void QDialog::resize ( const QSize & s )"Reimplemented for internal reasons; the API is not affected..SH "void QDialog::resize ( int w, int h ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPExamples:.(ltabdialog/main.cpp.)l.PPReimplemented from QWidget..SH "void QDialog::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QDialog::result () const"Returns the result code of the dialog..SH "void QDialog::setExtension ( QWidget * extension )"Sets \fIextension\fR to be the dialog's extension, or deletes the extensions if \fIextension\fR is 0..PPThe dialogs takes over ownership of the extension. Any previously set extension is deleted..PPThis function can only be called while the dialog is hidden..PPSee also showExtension(), setOrientation() and extension()..SH "void QDialog::setGeometry ( const QRect & r ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QDialog::setGeometry ( int x, int y, int w, int h ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QDialog::setOrientation ( Orientation orientation )"Sets the dialog to display its extension to the right of the main are if \fIorientation\fR is \fCHorizonal,\fR and to display it below the main area if \fIorientation\fR is \fCVertical.\fR.PPSee also orientation() and setExtension()..SH "void QDialog::setResult ( int ) \fC[protected]\fR"Sets the result code of the dialog..SH "void QDialog::setSizeGripEnabled ( bool enabled )"Enables or disables the QSizeGrip in the bottom right of the dialog. By default, the size grip is disabled..PPSee also isSizeGripEnabled()..SH "void QDialog::show () \fC[virtual]\fR"Shows the dialog box on the screen, as QWidget::show(), and selects a suitable position and size if none has been specified yet..PP\fBWarning:\fR In Qt 2.x, calling show() on a modal dialog enters a local event loop, and work like exec(), but not returning the result code exec() returns. Trolltech has always warned against doing this..PPIn Qt 3.0 and later, calling show() on a modal dialog will return immediately, \fInot\fR enter a local event loop. The dialog will of course be modal..PPSee also exec()..PPExamples:.(lmovies/main.cpp.)l.PPReimplemented from QWidget..SH "void QDialog::showExtension ( bool showIt ) \fC[protected slot]\fR"Extends the dialog to show its extension if \fIshowIt\fR is TRUE and hides it else..PPThis slot is usually connected to the QButton::toggled() signal of a QPushButton..PPIf the dialog is not visible, nothing happens..PPSee also show(), setExtension() and setOrientation()..SH "QSize QDialog::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "SEE ALSO".BR http://doc.trolltech.com/qdialog.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 make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qdialog.3qt) and the Qtversion (2.3.8).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -