Eneboo - Documentación para desarrolladores
|
The QDialog class is the base class of dialog windows. Más...
#include <qdialog.h>
Tipos públicos | |
enum | DialogCode { Rejected, Accepted, Rejected, Accepted } |
enum | DialogCode { Rejected, Accepted, Rejected, Accepted } |
Slots públicos | |
int | exec () |
int | exec () |
Métodos públicos | |
Q_EXPLICIT | QDialog (QWidget *parent=0, const char *name=0, bool modal=FALSE, WFlags f=0) |
~QDialog () | |
int | result () const |
void | show () |
void | hide () |
void | move (int x, int y) |
void | move (const QPoint &p) |
void | resize (int w, int h) |
void | resize (const QSize &) |
void | setGeometry (int x, int y, int w, int h) |
void | setGeometry (const QRect &) |
void | setOrientation (Orientation orientation) |
Orientation | orientation () const |
void | setExtension (QWidget *extension) |
QWidget * | extension () const |
QSize | sizeHint () const |
QSize | minimumSizeHint () const |
void | setSizeGripEnabled (bool) |
bool | isSizeGripEnabled () const |
void | setModal (bool modal) |
bool | isModal () const |
Q_EXPLICIT | QDialog (QWidget *parent=0, const char *name=0, bool modal=FALSE, WFlags f=0) |
~QDialog () | |
int | result () const |
void | show () |
void | hide () |
void | move (int x, int y) |
void | move (const QPoint &p) |
void | resize (int w, int h) |
void | resize (const QSize &) |
void | setGeometry (int x, int y, int w, int h) |
void | setGeometry (const QRect &) |
void | setOrientation (Orientation orientation) |
Orientation | orientation () const |
void | setExtension (QWidget *extension) |
QWidget * | extension () const |
QSize | sizeHint () const |
QSize | minimumSizeHint () const |
void | setSizeGripEnabled (bool) |
bool | isSizeGripEnabled () const |
void | setModal (bool modal) |
bool | isModal () const |
Slots protegidos | |
virtual void | done (int) |
virtual void | accept () |
virtual void | reject () |
void | showExtension (bool) |
virtual void | done (int) |
virtual void | accept () |
virtual void | reject () |
void | showExtension (bool) |
Métodos protegidos | |
void | setResult (int r) |
void | keyPressEvent (QKeyEvent *) |
void | closeEvent (QCloseEvent *) |
void | resizeEvent (QResizeEvent *) |
void | contextMenuEvent (QContextMenuEvent *) |
bool | eventFilter (QObject *, QEvent *) |
void | adjustPosition (QWidget *) |
void | setResult (int r) |
void | keyPressEvent (QKeyEvent *) |
void | closeEvent (QCloseEvent *) |
void | resizeEvent (QResizeEvent *) |
void | contextMenuEvent (QContextMenuEvent *) |
bool | eventFilter (QObject *, QEvent *) |
void | adjustPosition (QWidget *) |
Propiedades | |
bool | sizeGripEnabled |
whether the size grip is enabled | |
bool | modal |
whether show() should pop up the dialog as modal or modeless | |
Amigas | |
class | QPushButton |
The QDialog class is the base class of dialog windows.
A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user. QDialogs may be modal or modeless. QDialogs support extensibility and can provide a return value. They can have default buttons. QDialogs can also have a QSizeGrip in their lower-right corner, using setSizeGripEnabled().
Note that QDialog uses the parent widget slightly differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself). It will also share the parent's taskbar entry.
modal
enum QDialog::DialogCode |
enum QDialog::DialogCode |
Constructs a dialog called name, with parent parent.
A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent. It will also share the parent's taskbar entry.
The widget flags f are passed on to the QWidget constructor. If, for example, you don't want a What's This button in the titlebar of the dialog, pass WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu in f.
QDialog::~QDialog | ( | ) |
Destroys the QDialog, deleting all its children.
Q_EXPLICIT QDialog::QDialog | ( | QWidget * | parent = 0 , |
const char * | name = 0 , |
||
bool | modal = FALSE , |
||
WFlags | f = 0 |
||
) |
QDialog::~QDialog | ( | ) |
void QDialog::accept | ( | ) | [protected, virtual, slot] |
Hides the modal dialog and sets the result code to Accepted
.
Reimplementado en FileDialog.
virtual void QDialog::accept | ( | ) | [protected, virtual, slot] |
Reimplementado en FileDialog.
void QDialog::adjustPosition | ( | QWidget * | w | ) | [protected] |
void QDialog::adjustPosition | ( | QWidget * | ) | [protected] |
void QDialog::closeEvent | ( | QCloseEvent * | e | ) | [protected, virtual] |
This event handler, for event e, can be reimplemented in a subclass to receive widget close events.
The default implementation calls e->accept(), which hides this widget. See the QCloseEvent documentation for more details.
Reimplementado de QWidget.
Reimplementado en QMessageBox, QProgressDialog, QMessageBox y QProgressDialog.
void QDialog::closeEvent | ( | QCloseEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
Reimplementado en QMessageBox, QProgressDialog, QMessageBox y QProgressDialog.
void QDialog::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
This event handler, for event e, can be reimplemented in a subclass to receive widget context menu events.
The default implementation calls e->ignore(), which rejects the context event. See the QContextMenuEvent documentation for more details.
Reimplementado de QWidget.
void QDialog::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
void QDialog::done | ( | int | r | ) | [protected, virtual, slot] |
Closes the dialog and sets its result code to r. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return r.
As with QWidget::close(), done() deletes the dialog if the WDestructiveClose
flag is set. If the dialog is the application's main widget, the application terminates. If the dialog is the last window closed, the QApplication::lastWindowClosed() signal is emitted.
Reimplementado en QErrorMessage, QFileDialog, QErrorMessage y QFileDialog.
virtual void QDialog::done | ( | int | ) | [protected, virtual, slot] |
Reimplementado en QErrorMessage, QFileDialog, QErrorMessage y QFileDialog.
Reimplementado de QObject.
Reimplementado en QFileDialog, QWizard, QFileDialog y QWizard.
Filters events if this object has been installed as an event filter for the watched object.
In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.
Example:
class MyMainWindow : public QMainWindow { public: MyMainWindow( QWidget *parent = 0, const char *name = 0 ); protected: bool eventFilter( QObject *obj, QEvent *ev ); private: QTextEdit *textEdit; }; MyMainWindow::MyMainWindow( QWidget *parent, const char *name ) : QMainWindow( parent, name ) { textEdit = new QTextEdit( this ); setCentralWidget( textEdit ); textEdit->installEventFilter( this ); } bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev ) { if ( obj == textEdit ) { if ( e->type() == QEvent::KeyPress ) { QKeyEvent *k = (QKeyEvent*)ev; qDebug( "Ate key press %d", k->key() ); return TRUE; } else { return FALSE; } } else { // pass the event on to the parent class return QMainWindow::eventFilter( obj, ev ); } }
Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.
Reimplementado de QObject.
Reimplementado en QFileDialog, QWizard, QFileDialog y QWizard.
int QDialog::exec | ( | ) | [slot] |
int QDialog::exec | ( | ) | [slot] |
QWidget * QDialog::extension | ( | ) | const |
Returns the dialog's extension or 0 if no extension has been defined.
QWidget* QDialog::extension | ( | ) | const |
void QDialog::hide | ( | ) | [virtual] |
Hides the widget.
You almost never have to reimplement this function. If you need to do something after a widget is hidden, use hideEvent() instead.
Reimplementado de QWidget.
void QDialog::hide | ( | ) | [virtual] |
Reimplementado de QWidget.
bool QDialog::isModal | ( | ) | const |
Reimplementado de QWidget.
Reimplementado en QDesignerWizard y QDesignerDialog.
bool QDialog::isModal | ( | ) | const |
Reimplementado de QWidget.
Reimplementado en QDesignerWizard y QDesignerDialog.
bool QDialog::isSizeGripEnabled | ( | ) | const |
bool QDialog::isSizeGripEnabled | ( | ) | const |
void QDialog::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
Reimplementado en QFileDialog, QMessageBox, QFileDialog, QMessageBox y PhraseBookBox.
void QDialog::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
This event handler, for event e, can be reimplemented in a subclass to receive key press events for the widget.
A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.
If you reimplement this handler, it is very important that you explicitly ignore the event if you do not understand it, so that the widget's parent can interpret it; otherwise, the event will be implicitly accepted. Although top-level widgets are able to choose whether to accept or ignore unknown events because they have no parent widgets that could otherwise handle them, it is good practice to explicitly ignore events to make widgets as reusable as possible.
The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored.
Reimplementado de QWidget.
Reimplementado en QFileDialog, QMessageBox, QFileDialog, QMessageBox y PhraseBookBox.
Orientation QDialog::orientation | ( | ) | const |
Qt::Orientation QDialog::orientation | ( | ) | const |
Returns the dialog's extension orientation.
void QDialog::reject | ( | ) | [protected, virtual, slot] |
Hides the modal dialog and sets the result code to Rejected
.
Reimplementado en QDesignerWizard.
virtual void QDialog::reject | ( | ) | [protected, virtual, slot] |
Reimplementado en QDesignerWizard.
void QDialog::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
Widgets that have been created with the WNoAutoErase
flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.
The default implementation calls updateMask() if the widget has automatic masking enabled.
Reimplementado de QWidget.
Reimplementado en QFileDialog, QMessageBox, QProgressDialog, QTabDialog, QFileDialog, QMessageBox, QProgressDialog y QTabDialog.
void QDialog::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Reimplementado de QWidget.
Reimplementado en QFileDialog, QMessageBox, QProgressDialog, QTabDialog, QFileDialog, QMessageBox, QProgressDialog y QTabDialog.
int QDialog::result | ( | ) | const [inline] |
int QDialog::result | ( | ) | const [inline] |
Returns the modal dialog's result code, Accepted
or Rejected
.
Do not call this function if the dialog was constructed with the WDestructiveClose
flag.
void QDialog::setExtension | ( | QWidget * | extension | ) |
void QDialog::setExtension | ( | QWidget * | extension | ) |
Sets the widget, extension, to be the dialog's extension, deleting any previous extension. The dialog takes ownership of the extension. Note that if 0 is passed any existing extension will be deleted.
This function must only be called while the dialog is hidden.
void QDialog::setModal | ( | bool | modal | ) |
Reimplementado en QDesignerWizard y QDesignerDialog.
void QDialog::setModal | ( | bool | modal | ) |
Reimplementado en QDesignerWizard y QDesignerDialog.
void QDialog::setOrientation | ( | Orientation | orientation | ) |
If orientation is Horizontal
, the extension will be displayed to the right of the dialog's main area. If orientation is Vertical
, the extension will be displayed below the dialog's main area.
void QDialog::setOrientation | ( | Orientation | orientation | ) |
void QDialog::setResult | ( | int | i | ) | [inline, protected] |
Sets the modal dialog's result code to i.
void QDialog::setResult | ( | int | r | ) | [inline, protected] |
void QDialog::setSizeGripEnabled | ( | bool | enabled | ) |
void QDialog::setSizeGripEnabled | ( | bool | ) |
void QDialog::show | ( | ) | [virtual] |
Shows the dialog as a modeless dialog. Control returns immediately to the calling code.
The dialog will be modal or modeless according to the value of the modal property.
Reimplementado de QWidget.
Reimplementado en QTabDialog, QWizard, QTabDialog y QWizard.
void QDialog::show | ( | ) | [virtual] |
Shows the widget and its child widgets.
If its size or position has changed, Qt guarantees that a widget gets move and resize events just before it is shown.
You almost never have to reimplement this function. If you need to change some settings before a widget is shown, use showEvent() instead. If you need to do some delayed initialization use polish().
Reimplementado de QWidget.
Reimplementado en QTabDialog, QWizard, QTabDialog y QWizard.
void QDialog::showExtension | ( | bool | ) | [protected, slot] |
void QDialog::showExtension | ( | bool | showIt | ) | [protected, slot] |
If showIt is TRUE, the dialog's extension is shown; otherwise the extension is hidden.
This slot is usually connected to the QButton::toggled() signal of a QPushButton.
A dialog with a visible extension is not resizeable.
QSize QDialog::sizeHint | ( | ) | const [virtual] |
Reimplementado de QWidget.
Reimplementado en QSDialogPrivate, QProgressDialog y QProgressDialog.
QSize QDialog::sizeHint | ( | ) | const [virtual] |
Reimplementado de QWidget.
Reimplementado en QSDialogPrivate, QProgressDialog y QProgressDialog.
QPushButton [friend] |
bool QDialog::modal [read, write] |
bool QDialog::sizeGripEnabled [read, write] |
whether the size grip is enabled
A QSizeGrip is placed in the bottom right corner of the dialog when this property is enabled. By default, the size grip is disabled.