~osomon/webbrowser-app/qmltests

« back to all changes in this revision

Viewing changes to src/app/qquickshortcut_p.h

  • Committer: Olivier Tilloy
  • Date: 2017-04-05 09:38:41 UTC
  • mfrom: (1564.2.79 staging)
  • Revision ID: olivier.tilloy@canonical.com-20170405093841-xwbwj9cio2ja73ot
Merge the latest changes from staging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
**
3
 
** Copyright (C) 2015 The Qt Company Ltd.
4
 
** Contact: http://www.qt.io/licensing/
5
 
**
6
 
** This file is part of the QtQuick module of the Qt Toolkit.
7
 
**
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.
16
 
**
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.
25
 
**
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.
29
 
**
30
 
** $QT_END_LICENSE$
31
 
**
32
 
****************************************************************************/
33
 
 
34
 
#ifndef QQUICKSHORTCUT_P_H
35
 
#define QQUICKSHORTCUT_P_H
36
 
 
37
 
//
38
 
//  W A R N I N G
39
 
//  -------------
40
 
//
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.
44
 
//
45
 
// We mean it.
46
 
//
47
 
 
48
 
#include <QtCore/qobject.h>
49
 
#include <QtCore/qvariant.h>
50
 
#include <QtGui/qkeysequence.h>
51
 
#include <QtQml/qqmlparserstatus.h>
52
 
 
53
 
QT_BEGIN_NAMESPACE
54
 
 
55
 
class QQuickShortcut : public QObject, public QQmlParserStatus
56
 
{
57
 
    Q_OBJECT
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)
63
 
 
64
 
public:
65
 
    explicit QQuickShortcut(QObject *parent = Q_NULLPTR);
66
 
    ~QQuickShortcut();
67
 
 
68
 
    QVariant sequence() const;
69
 
    void setSequence(const QVariant &sequence);
70
 
 
71
 
    bool isEnabled() const;
72
 
    void setEnabled(bool enabled);
73
 
 
74
 
    bool autoRepeat() const;
75
 
    void setAutoRepeat(bool repeat);
76
 
 
77
 
    Qt::ShortcutContext context() const;
78
 
    void setContext(Qt::ShortcutContext context);
79
 
 
80
 
Q_SIGNALS:
81
 
    void sequenceChanged();
82
 
    void enabledChanged();
83
 
    void autoRepeatChanged();
84
 
    void contextChanged();
85
 
 
86
 
    void activated();
87
 
    void activatedAmbiguously();
88
 
 
89
 
protected:
90
 
    void classBegin() Q_DECL_OVERRIDE;
91
 
    void componentComplete() Q_DECL_OVERRIDE;
92
 
    bool event(QEvent *event) Q_DECL_OVERRIDE;
93
 
 
94
 
    void grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context);
95
 
    void ungrabShortcut();
96
 
 
97
 
private:
98
 
    int m_id;
99
 
    bool m_enabled;
100
 
    bool m_completed;
101
 
    bool m_autorepeat;
102
 
    QKeySequence m_shortcut;
103
 
    Qt::ShortcutContext m_context;
104
 
    QVariant m_sequence;
105
 
};
106
 
 
107
 
QT_END_NAMESPACE
108
 
 
109
 
#endif // QQUICKSHORTCUT_P_H