Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
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// Qt-Security score:significant reason:default
4
5#ifndef QDIALOG_H
6#define QDIALOG_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qwidget.h>
10
12
13QT_BEGIN_NAMESPACE
14
15
16class QPushButton;
17class QDialogPrivate;
18
19class Q_WIDGETS_EXPORT QDialog : public QWidget
20{
21 Q_OBJECT
22 friend class QPushButton;
23
24 Q_PROPERTY(bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled)
25 Q_PROPERTY(bool modal READ isModal WRITE setModal)
26
27public:
28 explicit QDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
29 ~QDialog();
30
31 enum DialogCode { Rejected, Accepted };
32 Q_ENUM(DialogCode)
33
34 int result() const;
35
36 void setVisible(bool visible) override;
37
38 QSize sizeHint() const override;
39 QSize minimumSizeHint() const override;
40
41 void setSizeGripEnabled(bool);
42 bool isSizeGripEnabled() const;
43
44 void setModal(bool modal);
45 void setResult(int r);
46
47Q_SIGNALS:
48 void finished(int result);
49 void accepted();
50 void rejected();
51
52public Q_SLOTS:
53 virtual void open();
54 virtual int exec();
55 virtual void done(int);
56 virtual void accept();
57 virtual void reject();
58
59protected:
60 QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
61
62 void keyPressEvent(QKeyEvent *) override;
63 void closeEvent(QCloseEvent *) override;
64 void showEvent(QShowEvent *) override;
65 void resizeEvent(QResizeEvent *) override;
66#ifndef QT_NO_CONTEXTMENU
67 void contextMenuEvent(QContextMenuEvent *) override;
68#endif
69 bool eventFilter(QObject *, QEvent *) override;
70 void adjustPosition(QWidget*);
71private:
72 Q_DECLARE_PRIVATE(QDialog)
73 Q_DISABLE_COPY(QDialog)
74};
75
76QT_END_NAMESPACE
77
78#endif // QDIALOG_H
The QDialog class is the base class of dialog windows.
Definition qdialog.h:20
QT_REQUIRE_CONFIG(dialog)