1// qdialog.sip generated by MetaSIP
2//
3// This file is part of the QtWidgets Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QDialog : QWidget
24{
25%TypeHeaderCode
26#include <qdialog.h>
27%End
28
29public:
30    QDialog(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags());
31    virtual ~QDialog();
32
33    enum DialogCode
34    {
35        Rejected,
36        Accepted,
37    };
38
39    int result() const;
40    virtual void setVisible(bool visible);
41    virtual QSize sizeHint() const;
42    virtual QSize minimumSizeHint() const;
43    void setSizeGripEnabled(bool);
44    bool isSizeGripEnabled() const;
45    void setModal(bool modal);
46    void setResult(int r);
47    virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/;
48%MethodCode
49        // Transfer ownership back to Python (a modal dialog will probably have the
50        // main window as it's parent).  This means the Qt dialog will be deleted when
51        // the Python wrapper is garbage collected.  Although this is a little
52        // inconsistent, it saves having to code it explicitly to avoid the memory
53        // leak.
54        sipTransferBack(sipSelf);
55
56        Py_BEGIN_ALLOW_THREADS
57        sipRes = sipSelfWasArg ? sipCpp->QDialog::exec()
58                               : sipCpp->exec();
59        Py_END_ALLOW_THREADS
60%End
61
62%If (Py_v3)
63    virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
64%MethodCode
65        // Transfer ownership back to Python (a modal dialog will probably have the
66        // main window as it's parent).  This means the Qt dialog will be deleted when
67        // the Python wrapper is garbage collected.  Although this is a little
68        // inconsistent, it saves having to code it explicitly to avoid the memory
69        // leak.
70        sipTransferBack(sipSelf);
71
72        Py_BEGIN_ALLOW_THREADS
73        sipRes = sipSelfWasArg ? sipCpp->QDialog::exec()
74                               : sipCpp->exec();
75        Py_END_ALLOW_THREADS
76%End
77
78%End
79
80public slots:
81    virtual void done(int);
82    virtual void accept();
83    virtual void reject();
84    virtual void open();
85
86signals:
87    void accepted();
88    void finished(int result);
89    void rejected();
90
91protected:
92    virtual void keyPressEvent(QKeyEvent *);
93    virtual void closeEvent(QCloseEvent *);
94    virtual void showEvent(QShowEvent *);
95    virtual void resizeEvent(QResizeEvent *);
96    virtual void contextMenuEvent(QContextMenuEvent *);
97    virtual bool eventFilter(QObject *, QEvent *);
98};
99