Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
|
The QDialog class is the base class of dialog windows. More...
#include <qdialog.h>
Inherits QWidget.
Inherited by PhoneBook, QTabDialog, QWizard, MediaFileInfoWidget, DocPropertiesDialog, ImageSelectorDialog, EditCategoriesDialog, QColorDialog, QFileDialog, QFontDialog, QInputDialog, and QMessageBox.
A 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.
Modality means that the dialog blocks input to other windows: The user has 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).
The 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.
Extensibility 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().
Since 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.
Note 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.
QDialog also can provide a QSizeGrip in its lower-right corner. If you want that, call setSizeGripEnabled( TRUE ).
See also QTabDialog, QWidget, QSemiModal, and GUI Design Handbook: Dialogs, Standard..
The dialog is modal (blocks input to other windows) if modal is TRUE, and modeless if modal is FALSE (this is the default).
The widget flags f are sent to the QWidget constructor, as usual.
If 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.
We recommend always passing a parent.
See also QWidget::setWFlags and Qt::WidgetFlags.
If the dialog has the WDestructiveClose flag set, done() also deletes the dialog. If the dialog is the applications's main widget, the application quits.
See also accept(), reject(), QApplication::mainWidget(), and QApplication::quit().
Reimplemented in DocPropertiesDialog.
If the dialog is modeless, the behaviour of this function is undefined.
See also setExtension().
Returns TRUE if the QDialog has a QSizeGrip in the bottom right of the dialog, and FALSE if it does not.
See also setSizeGripEnabled().
See also setOrientation().
Returns the result code of the dialog.
The dialogs takes over ownership of the extension. Any previously set extension is deleted.
This function can only be called while the dialog is hidden.
See also showExtension(), setOrientation(), and extension().
See also orientation() and setExtension().
Sets the result code of the dialog.
See also isSizeGripEnabled().
Warning:
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.
In Qt 3.0 and later, calling show() on a modal dialog will return immediately, not enter a local event loop. The dialog will of course be modal.
See also exec().
Reimplemented from QWidget.
This slot is usually connected to the QButton::toggled() signal of a QPushButton.
If the dialog is not visible, nothing happens.
See also show(), setExtension(), and setOrientation().
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|