Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qdialog.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDIALOG_H
5#define QDIALOG_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qwidget.h>
9
11
13
14
15class QPushButton;
16class QDialogPrivate;
17
18class Q_WIDGETS_EXPORT QDialog : public QWidget
19{
21 friend class QPushButton;
22
23 Q_PROPERTY(bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled)
24 Q_PROPERTY(bool modal READ isModal WRITE setModal)
25
26public:
27 explicit QDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
28 ~QDialog();
29
30 enum DialogCode { Rejected, Accepted };
31
32 int result() const;
33
34 void setVisible(bool visible) override;
35
36 QSize sizeHint() const override;
37 QSize minimumSizeHint() const override;
38
39 void setSizeGripEnabled(bool);
40 bool isSizeGripEnabled() const;
41
42 void setModal(bool modal);
43 void setResult(int r);
44
46 void finished(int result);
47 void accepted();
48 void rejected();
49
50public Q_SLOTS:
51 virtual void open();
52 virtual int exec();
53 virtual void done(int);
54 virtual void accept();
55 virtual void reject();
56
57protected:
58 QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
59
60 void keyPressEvent(QKeyEvent *) override;
61 void closeEvent(QCloseEvent *) override;
62 void showEvent(QShowEvent *) override;
63 void resizeEvent(QResizeEvent *) override;
64#ifndef QT_NO_CONTEXTMENU
65 void contextMenuEvent(QContextMenuEvent *) override;
66#endif
67 bool eventFilter(QObject *, QEvent *) override;
68 void adjustPosition(QWidget*);
69private:
70 Q_DECLARE_PRIVATE(QDialog)
71 Q_DISABLE_COPY(QDialog)
72};
73
75
76#endif // QDIALOG_H
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:561
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition qevent.h:593
The QDialog class is the base class of dialog windows.
Definition qdialog.h:19
void finished(int result)
void rejected()
DialogCode
The value returned by a modal dialog.
Definition qdialog.h:30
void accepted()
\inmodule QtCore
Definition qcoreevent.h:45
The QKeyEvent class describes a key event.
Definition qevent.h:423
\inmodule QtCore
Definition qobject.h:90
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
Definition qobject.cpp:1518
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:547
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:577
\inmodule QtCore
Definition qsize.h:25
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
virtual void closeEvent(QCloseEvent *event)
This event handler is called with the given event when Qt receives a window close request for a top-l...
Definition qwidget.cpp:9902
QSize minimumSizeHint
the recommended minimum size for the widget
Definition qwidget.h:149
virtual void setVisible(bool visible)
Definition qwidget.cpp:8329
QSize sizeHint
the recommended size for the widget
Definition qwidget.h:148
virtual void resizeEvent(QResizeEvent *event)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition qwidget.cpp:9868
virtual void keyPressEvent(QKeyEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive key press events f...
Definition qwidget.cpp:9652
virtual void showEvent(QShowEvent *event)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
virtual void contextMenuEvent(QContextMenuEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive widget context men...
Definition qwidget.cpp:9921
Combined button and popup list for selecting options.
GLboolean r
[2]
GLfloat GLfloat f
GLuint64EXT * result
[6]
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
file open(QIODevice::ReadOnly)
dialog exec()
QFileDialog dialog(this)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent