diff options
Diffstat (limited to 'src/widgets/kernel/qshortcut.h')
-rw-r--r-- | src/widgets/kernel/qshortcut.h | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h index 384f1967c9..a519a8696a 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,28 +42,23 @@ #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 shortcutContext = Qt::WindowShortcut); + explicit QShortcut(const QKeySequence& key, QWidget *parent, + const char *member = nullptr, const char *ambiguousMember = nullptr, + Qt::ShortcutContext shortcutContext = Qt::WindowShortcut); #ifdef Q_CLANG_QDOC template<typename Functor> QShortcut(const QKeySequence &key, QWidget *parent, @@ -126,36 +121,13 @@ public: #endif ~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 |