Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
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 Q_ENUM(DialogCode)
32
33 int result() const;
34
35 void setVisible(bool visible) override;
36
37 QSize sizeHint() const override;
38 QSize minimumSizeHint() const override;
39
40 void setSizeGripEnabled(bool);
41 bool isSizeGripEnabled() const;
42
43 void setModal(bool modal);
44 void setResult(int r);
45
47 void finished(int result);
48 void accepted();
49 void rejected();
50
51public Q_SLOTS:
52 virtual void open();
53 virtual int exec();
54 virtual void done(int);
55 virtual void accept();
56 virtual void reject();
57
58protected:
59 QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
60
61 void keyPressEvent(QKeyEvent *) override;
62 void closeEvent(QCloseEvent *) override;
63 void showEvent(QShowEvent *) override;
64 void resizeEvent(QResizeEvent *) override;
65#ifndef QT_NO_CONTEXTMENU
66 void contextMenuEvent(QContextMenuEvent *) override;
67#endif
68 bool eventFilter(QObject *, QEvent *) override;
69 void adjustPosition(QWidget*);
70private:
71 Q_DECLARE_PRIVATE(QDialog)
72 Q_DISABLE_COPY(QDialog)
73};
74
76
77#endif // QDIALOG_H
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:562
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition qevent.h:594
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:424
\inmodule QtCore
Definition qobject.h:103
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:578
\inmodule QtCore
Definition qsize.h:25
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.
Definition qcompare.h:63
GLboolean r
[2]
GLfloat GLfloat f
GLuint64EXT * result
[6]
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define explicit
file open(QIODevice::ReadOnly)
dialog exec()
QFileDialog dialog(this)
[1]