📄 qdialog.3qt
字号:
.TH QDialog 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech 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.SH SYNOPSIS.br.PP\fC#include <qdialog.h>\fR.PPInherits QWidget..PPInherited by QColorDialog, QFileDialog, QFontDialog, 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 "virtual void \fBhide\fR ()".br.ti -1c.BI "virtual void \fBmove\fR ( int " "x" ", int y )".br.ti -1c.BI "void \fBmove\fR ( const QPoint & p )".br.ti -1c.BI "virtual void \fBresize\fR ( int " "w" ", int h )".br.ti -1c.BI "void \fBresize\fR ( const QSize & )".br.ti -1c.BI "virtual void \fBsetGeometry\fR ( int " "x" ", int " "y" ", int " "w" ", int h )".br.ti -1c.BI "virtual void \fBsetGeometry\fR ( const QRect & )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBsetResult\fR ( int r )".br.ti -1c.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * )".br.ti -1c.BI "virtual void \fBcloseEvent\fR ( QCloseEvent * )".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.in -1c.SH DESCRIPTIONThe QDialog class is the base class of dialog windows..PPA dialog window is a widget used to communicate with the user. It offers mechanisms such as default buttons..PPThe dialog window can either be modeless or modal. A modeless dialog is a normal window, while a modal window must be finished before the user can continue with other parts of the program. The third constructor argument must be set to TRUE to create a modal dialog, otherwise it will create a modeless dialog..PPExample (your own modal dialog):.PP.nf.br class Modal : public QDialog {.br Q_OBJECT.br public:.br Modal( QWidget *parent, QString name );.br };.br.br Modal::Modal( QWidget *parent, QString name ).br : QDialog( parent, name, TRUE ).br {.br QPushButton *ok, *cancel;.br ok = new QPushButton( "OK", this );.br ok->setGeometry( 10,10, 100,30 );.br connect( ok, SIGNAL(clicked()), SLOT(accept()) );.br cancel = new QPushButton( "Cancel", this );.br cancel->setGeometry( 10,60, 100,30 );.br connect( cancel, SIGNAL(clicked()), SLOT(reject()) );.br }.fi.PPNote that the parent widget has an additional meaning for modal dialogs. A modal dialog is placed on top of the parent widget. The dialog is centered on the screen if the parent widget is zero..PPYou would normally call exec() to start a modal dialog. This enters a local event loop, which is terminated when the modal dialog calls done() (or accept() or reject())..PPExample (using a modal dialog):.PP.nf.br Modal m;.br if ( m.exec() ) {.br // ok was pressed, then fetch the interesting dialog data.br }.fi.PPModeless dialogs behave just like ordinary toplevel widgets. The only difference is that they have the default button mechanism..PPSee also: QTabDialog, QWidget, QSemiModal and GUI Design Handbook: Dialogs, Standard..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 will by default be modeless, unless you set \fImodal\fR to TRUE to construct a modal dialog..PPThe \fIf\fR argument is the widget flags, which can be used to customize the window frame style..PPA dialog is always a top level widget. The optional parent, however, will know about this child and also delete it on destruction. Furthermore, the window system will be able to tell that both the dialog and the parent belong together. This works for Windows and also some X11 window managers, that will for instance provide a common taskbar entry in that case..PPIt is recommended to pass a parent..SH "QDialog::~QDialog ()"Destroys the QDialog and all its children..SH "void QDialog::accept () \fC[virtual protected slot]\fR"Closes the dialog and sets the result code to \fCAccepted.\fR.PPEquivalent to done(Accepted);..SH "void QDialog::closeEvent ( QCloseEvent * e ) \fC[virtual protected]\fR"Calls reject() if it is a modal dialog, or accepts the close event if it is a modeless dialog..PPReimplemented from QWidget..SH "void QDialog::done ( int r ) \fC[virtual protected slot]\fR"Closes the dialog and sets the result code to \fIr.\fR.PPEquivalent to calling hide(), then setResult(\fIr\fR )..PPThis function is very useful for modal dialogs. It leaves the local event loop and returns from the exec() or show() function..PP\fBWarning:\fR Although done() will return to the caller also if this dialog is modal, the local event loop is then marked for termination. Hence, a program should not try to do anything that depends on event handling before the corresponding exec() or show() has returned..PPSee also: accept() and reject()..SH "int QDialog::exec ()"For modal dialogs: Starts the dialog and returns the result code..PPEquivalent to calling show(), then result()..PPThis function is very useful for modal dialogs, but makes no sense for modeless dialog. It enters a new local event loop. The event loop is terminated when the dialog is hidden, usually by calling done()..PPA warning message is printed if you call this function for a modeless dialog..PPSee also: show() and result()..PPExamples:.(lqdir/qdir.cpp wizard/main.cpp.)l.SH "void QDialog::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Handles key press events for the dialog..PPCalls reject() if Escape is pressed. Simulates a button click for the default button if Enter is pressed. All other keys are ignored..PPReimplemented from QWidget..SH "void QDialog::move ( const QPoint & p )"Reimplements QWidget::move() for internal purposes..SH "void QDialog::move ( int x, int y ) \fC[virtual]\fR"Reimplements QWidget::move() for internal purposes..PPReimplemented from QWidget..SH "void QDialog::reject () \fC[virtual protected slot]\fR"Closes the dialog and sets the result code to \fCRejected.\fR.PPEquivalent to done(Rejected);..SH "void QDialog::resize ( const QSize & s )"Reimplements QWidget::resize() for internal purposes..SH "void QDialog::resize ( int w, int h ) \fC[virtual]\fR"Reimplements QWidget::resize() for internal purposes..PPReimplemented from QWidget..SH "int QDialog::result () const"Returns the result code of the dialog..SH "void QDialog::setGeometry ( const QRect & r ) \fC[virtual]\fR"Reimplements QWidget::setGeometry() for internal purposes..PPReimplemented from QWidget..SH "void QDialog::setGeometry ( int x, int y, int w, int h ) \fC[virtual]\fR"Reimplements QWidget::setGeometry() for internal purposes..PPReimplemented from QWidget..SH "void QDialog::setResult ( int ) \fC[protected]\fR"Sets the result code of the dialog..SH "void QDialog::show () \fC[virtual]\fR"Shows the dialog box on the screen, as QWidget::show() and enters a local event loop if this dialog is modal (see constructor)..PPThis implementation also does automatic resizing and automatic positioning. If you have not already resized or moved the dialog, it will find a size that fits the contents and a position near the middle of the screen (or centered relative to the parent widget if any)..PP\fBWarning:\fR Calling show() for a modal dialog enters a local event loop. The event loop is terminated when the dialog is hidden, usually by calling done()..PPSee also: exec()..PPExamples:.(lmovies/main.cpp.)l.PPReimplemented from QWidget..SH "SEE ALSO".BR http://www.troll.no/qt/qdialog.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -