1// qshortcut.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 QShortcut : QObject
24{
25%TypeHeaderCode
26#include <qshortcut.h>
27%End
28
29public:
30    explicit QShortcut(QWidget *parent /TransferThis/);
31    QShortcut(const QKeySequence &key, QWidget *parent /TransferThis/, SIP_PYOBJECT member /TypeHint="PYQT_SLOT"/ = 0, SIP_PYOBJECT ambiguousMember /TypeHint="PYQT_SLOT"/ = 0, Qt::ShortcutContext context = Qt::WindowShortcut) [(const QKeySequence &key, QWidget *parent, const char *member = 0, const char *ambiguousMember = 0, Qt::ShortcutContext context = Qt::WindowShortcut)];
32%MethodCode
33        // Construct the shortcut without any connections.
34        Py_BEGIN_ALLOW_THREADS
35        sipCpp = new sipQShortcut(*a0, a1, 0, 0, a4);
36        Py_END_ALLOW_THREADS
37
38        if (a2)
39        {
40            QObject *rx2;
41            QByteArray member2;
42
43            if ((sipError = pyqt5_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &rx2, member2)) == sipErrorNone)
44            {
45                Py_BEGIN_ALLOW_THREADS
46                QObject::connect(sipCpp, SIGNAL(activated()), rx2,
47                        member2.constData());
48                Py_END_ALLOW_THREADS
49            }
50            else
51            {
52                delete sipCpp;
53
54                if (sipError == sipErrorContinue)
55                    sipError = sipBadCallableArg(2, a2);
56            }
57        }
58
59        if (a3)
60        {
61            QObject *rx3;
62            QByteArray member3;
63
64            if ((sipError = pyqt5_qtwidgets_get_connection_parts(a3, sipCpp, "()", false, &rx3, member3)) == sipErrorNone)
65            {
66                Py_BEGIN_ALLOW_THREADS
67                QObject::connect(sipCpp, SIGNAL(activatedAmbiguously()), rx3,
68                        member3.constData());
69                Py_END_ALLOW_THREADS
70            }
71            else
72            {
73                delete sipCpp;
74
75                if (sipError == sipErrorContinue)
76                    sipError = sipBadCallableArg(3, a3);
77            }
78        }
79%End
80
81    virtual ~QShortcut();
82    void setKey(const QKeySequence &key);
83    QKeySequence key() const;
84    void setEnabled(bool enable);
85    bool isEnabled() const;
86    void setContext(Qt::ShortcutContext context);
87    Qt::ShortcutContext context() const;
88    void setWhatsThis(const QString &text);
89    QString whatsThis() const;
90    int id() const;
91    QWidget *parentWidget() const;
92    void setAutoRepeat(bool on);
93    bool autoRepeat() const;
94
95signals:
96    void activated();
97    void activatedAmbiguously();
98
99protected:
100    virtual bool event(QEvent *e);
101};
102