summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qshortcut.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qshortcut.h')
-rw-r--r--src/widgets/kernel/qshortcut.h46
1 files changed, 9 insertions, 37 deletions
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 6dcf4971b2..6ac9a37fe3 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -42,60 +42,32 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-#include <QtGui/qkeysequence.h>
-
-QT_BEGIN_NAMESPACE
+#include <QtGui/qguishortcut.h>
+QT_REQUIRE_CONFIG(shortcut);
-#ifndef QT_NO_SHORTCUT
+QT_BEGIN_NAMESPACE
class QShortcutPrivate;
-class Q_WIDGETS_EXPORT QShortcut : public QObject
+class Q_WIDGETS_EXPORT QShortcut : public QGuiShortcut
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QShortcut)
- Q_PROPERTY(QKeySequence key READ key WRITE setKey)
Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
- Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
- Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
+ Q_DECLARE_PRIVATE(QShortcut)
public:
explicit QShortcut(QWidget *parent);
- QShortcut(const QKeySequence& key, QWidget *parent,
- const char *member = nullptr, const char *ambiguousMember = nullptr,
- Qt::ShortcutContext context = Qt::WindowShortcut);
+ explicit QShortcut(const QKeySequence& key, QWidget *parent,
+ const char *member = nullptr, const char *ambiguousMember = nullptr,
+ Qt::ShortcutContext context = Qt::WindowShortcut);
~QShortcut();
- void setKey(const QKeySequence& key);
- QKeySequence key() const;
-
- void setEnabled(bool enable);
- bool isEnabled() const;
-
- void setContext(Qt::ShortcutContext context);
- Qt::ShortcutContext context() const;
-
void setWhatsThis(const QString &text);
QString whatsThis() const;
- void setAutoRepeat(bool on);
- bool autoRepeat() const;
-
- int id() const;
-
inline QWidget *parentWidget() const
{ return static_cast<QWidget *>(QObject::parent()); }
-
-Q_SIGNALS:
- void activated();
- void activatedAmbiguously();
-
-protected:
- bool event(QEvent *e) override;
};
-#endif // QT_NO_SHORTCUT
-
QT_END_NAMESPACE
#endif // QSHORTCUT_H