Eneboo - Documentación para desarrolladores
Tipos públicos | Slots públicos | Métodos públicos | Slots protegidos | Métodos protegidos | Propiedades | Amigas
Referencia de la Clase QDialog

The QDialog class is the base class of dialog windows. Más...

#include <qdialog.h>

Diagrama de herencias de QDialog
QWidget QWidget QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject FindDialog PhraseBookBox QColorDialog QColorDialog QDesignerDialog QErrorMessage QErrorMessage QFDProgressDialog QFileDialog QFileDialog QFontDialog QFontDialog QInputDialog QInputDialog QMessageBox QMessageBox QPrintDialog QPrintDialog QProgressDialog QProgressDialog QSDialogPrivate QSemiModal QSemiModal QTabDialog QTabDialog QWizard QWizard QwtDesignerPlugin::PlotDialog

Lista de todos los miembros.

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)
QWidgetextension () 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)
QWidgetextension () 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

Descripción detallada

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


Documentación de las enumeraciones miembro de la clase

The value returned by a modal dialog.

Accepted Rejected

Valores de enumeraciones:
Rejected 
Accepted 
Rejected 
Accepted 
Valores de enumeraciones:
Rejected 
Accepted 
Rejected 
Accepted 

Documentación del constructor y destructor

QDialog::QDialog ( QWidget parent = 0,
const char *  name = 0,
bool  modal = FALSE,
WFlags  f = 0 
)

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.

Atención:
In Qt 3.2, the modal flag is obsolete. There is now a setModal() function that can be used for obtaining a modal behavior when calling show(). This is rarely needed, because modal dialogs are usually invoked using exec(), which ignores the modal flag.
Ver también:
QWidget::setWFlags() Qt::WidgetFlags
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 ( )

Documentación de las funciones miembro

void QDialog::accept ( ) [protected, virtual, slot]

Hides the modal dialog and sets the result code to Accepted.

Ver también:
reject() done()

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.

Ver también:
event(), hide(), close(), QCloseEvent

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.

Ver también:
event(), QContextMenuEvent

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.

Ver también:
accept(), reject(), QApplication::mainWidget(), QApplication::quit()

Reimplementado en QErrorMessage, QFileDialog, QErrorMessage y QFileDialog.

virtual void QDialog::done ( int  ) [protected, virtual, slot]
bool QDialog::eventFilter ( QObject o,
QEvent e 
) [protected, virtual]

Reimplementado de QObject.

Reimplementado en QFileDialog, QWizard, QFileDialog y QWizard.

bool QDialog::eventFilter ( QObject ,
QEvent  
) [protected, virtual]

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.

Atención:
If you delete the receiver object in this function, be sure to return TRUE. Otherwise, Qt will forward the event to the deleted object and the program might crash.
Ver también:
installEventFilter()

Reimplementado de QObject.

Reimplementado en QFileDialog, QWizard, QFileDialog y QWizard.

int QDialog::exec ( ) [slot]

Shows the dialog as a modal dialog, blocking until the user closes it. The function returns a DialogCode result.

Users cannot interact with any other window in the same application until they close the dialog.

Ver también:
show(), result()
int QDialog::exec ( ) [slot]
QWidget * QDialog::extension ( ) const

Returns the dialog's extension or 0 if no extension has been defined.

Ver también:
setExtension()
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.

Ver también:
hideEvent(), isHidden(), show(), showMinimized(), isVisible(), close()

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.

Ver también:
keyReleaseEvent(), QKeyEvent::ignore(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), QKeyEvent

Reimplementado de QWidget.

Reimplementado en QFileDialog, QMessageBox, QFileDialog, QMessageBox y PhraseBookBox.

QSize QDialog::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

QSize QDialog::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

void QDialog::move ( int  x,
int  y 
) [virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This corresponds to move( QPoint(x, y) ).

Reimplementado de QWidget.

void QDialog::move ( int  x,
int  y 
) [virtual]

Reimplementado de QWidget.

void QDialog::move ( const QPoint p)

Reimplementado de QWidget.

void QDialog::move ( const QPoint p)

Reimplementado de QWidget.

Orientation QDialog::orientation ( ) const
Qt::Orientation QDialog::orientation ( ) const

Returns the dialog's extension orientation.

Ver también:
setOrientation()
void QDialog::reject ( ) [protected, virtual, slot]

Hides the modal dialog and sets the result code to Rejected.

Ver también:
accept() done()

Reimplementado en QDesignerWizard.

virtual void QDialog::reject ( ) [protected, virtual, slot]

Reimplementado en QDesignerWizard.

void QDialog::resize ( int  w,
int  h 
) [virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This corresponds to resize( QSize(w, h) ).

Reimplementado de QWidget.

void QDialog::resize ( const QSize )

Reimplementado de QWidget.

void QDialog::resize ( int  w,
int  h 
) [virtual]

Reimplementado de QWidget.

void QDialog::resize ( const QSize s)

Reimplementado de QWidget.

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.

Ver también:
moveEvent(), event(), resize(), QResizeEvent, paintEvent()

Reimplementado de QWidget.

Reimplementado en QFileDialog, QMessageBox, QProgressDialog, QTabDialog, QFileDialog, QMessageBox, QProgressDialog y QTabDialog.

void QDialog::resizeEvent ( QResizeEvent ) [protected, virtual]
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.

Ver también:
showExtension(), setOrientation(), extension()
void QDialog::setGeometry ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Reimplementado de QWidget.

void QDialog::setGeometry ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This corresponds to setGeometry( QRect(x, y, w, h) ).

Reimplementado de QWidget.

void QDialog::setGeometry ( const QRect ) [virtual]

Reimplementado de QWidget.

void QDialog::setGeometry ( const QRect r) [virtual]

Reimplementado de QWidget.

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.

Ver también:
orientation(), setExtension()
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.

Ver también:
exec(), modal

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().

Ver también:
showEvent(), hide(), showMinimized(), showMaximized(), showNormal(), isVisible(), 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.

Ver también:
show(), setExtension(), setOrientation()
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.


Documentación de las funciones relacionadas y clases amigas

QPushButton [friend]

Documentación de propiedades

bool QDialog::modal [read, write]

whether show() should pop up the dialog as modal or modeless

By default, this property is false and show() pops up the dialog as modeless.

exec() ignores the value of this property and always pops up the dialog as modal.

Ver también:
show(), exec()
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.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'