1
/****************************************************************************
3
** Copyright (C) 2015 The Qt Company Ltd.
4
** Contact: http://www.qt.io/licensing/
6
** This file is part of the QtQuick module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL21$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and The Qt Company. For licensing terms
14
** and conditions see http://www.qt.io/terms-conditions. For further
15
** information use the contact form at http://www.qt.io/contact-us.
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 or version 3 as published by the Free
20
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22
** following information to ensure the GNU Lesser General Public License
23
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26
** As a special exception, The Qt Company gives you certain additional
27
** rights. These rights are described in The Qt Company LGPL Exception
28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
32
****************************************************************************/
34
#ifndef QQUICKSHORTCUT_P_H
35
#define QQUICKSHORTCUT_P_H
41
// This file is not part of the Qt API. It exists purely as an
42
// implementation detail. This header file may change from version to
43
// version without notice, or even be removed.
48
#include <QtCore/qobject.h>
49
#include <QtCore/qvariant.h>
50
#include <QtGui/qkeysequence.h>
51
#include <QtQml/qqmlparserstatus.h>
55
class QQuickShortcut : public QObject, public QQmlParserStatus
58
Q_INTERFACES(QQmlParserStatus)
59
Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
60
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
61
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
62
Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
65
explicit QQuickShortcut(QObject *parent = Q_NULLPTR);
68
QVariant sequence() const;
69
void setSequence(const QVariant &sequence);
71
bool isEnabled() const;
72
void setEnabled(bool enabled);
74
bool autoRepeat() const;
75
void setAutoRepeat(bool repeat);
77
Qt::ShortcutContext context() const;
78
void setContext(Qt::ShortcutContext context);
81
void sequenceChanged();
82
void enabledChanged();
83
void autoRepeatChanged();
84
void contextChanged();
87
void activatedAmbiguously();
90
void classBegin() Q_DECL_OVERRIDE;
91
void componentComplete() Q_DECL_OVERRIDE;
92
bool event(QEvent *event) Q_DECL_OVERRIDE;
94
void grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context);
95
void ungrabShortcut();
102
QKeySequence m_shortcut;
103
Qt::ShortcutContext m_context;
109
#endif // QQUICKSHORTCUT_P_H