Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qkeysequenceedit.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2013 Ivan Komissarov.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QKEYSEQUENCEEDIT_H
7#define QKEYSEQUENCEEDIT_H
8
9#include <QtWidgets/qtwidgetsglobal.h>
10#include <QtWidgets/qwidget.h>
11
13
14QT_BEGIN_NAMESPACE
15
16class QKeySequenceEditPrivate;
17class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
18{
19 Q_OBJECT
20 Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence
21 NOTIFY keySequenceChanged USER true)
22 Q_PROPERTY(bool clearButtonEnabled READ isClearButtonEnabled WRITE setClearButtonEnabled)
23 Q_PROPERTY(qsizetype maximumSequenceLength READ maximumSequenceLength WRITE setMaximumSequenceLength)
24 Q_PROPERTY(QList<QKeyCombination> finishingKeyCombinations READ finishingKeyCombinations WRITE setFinishingKeyCombinations)
25
26public:
27 explicit QKeySequenceEdit(QWidget *parent = nullptr);
28 explicit QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent = nullptr);
29 ~QKeySequenceEdit();
30
31 QKeySequence keySequence() const;
32 qsizetype maximumSequenceLength() const;
33
34 void setClearButtonEnabled(bool enable);
35 bool isClearButtonEnabled() const;
36
37 void setFinishingKeyCombinations(const QList<QKeyCombination> &finishingKeyCombinations);
38 QList<QKeyCombination> finishingKeyCombinations() const;
39
40public Q_SLOTS:
41 void setKeySequence(const QKeySequence &keySequence);
42 void clear();
43 void setMaximumSequenceLength(qsizetype count);
44
45Q_SIGNALS:
46 void editingFinished();
47 void keySequenceChanged(const QKeySequence &keySequence);
48
49protected:
50 QKeySequenceEdit(QKeySequenceEditPrivate &d, QWidget *parent, Qt::WindowFlags f);
51
52 bool event(QEvent *) override;
53 void keyPressEvent(QKeyEvent *) override;
54 void keyReleaseEvent(QKeyEvent *) override;
55 void timerEvent(QTimerEvent *) override;
56 void focusOutEvent(QFocusEvent *) override;
57
58private:
59 Q_DISABLE_COPY(QKeySequenceEdit)
60 Q_DECLARE_PRIVATE(QKeySequenceEdit)
61};
62
63QT_END_NAMESPACE
64
65#endif // QKEYSEQUENCEEDIT_H
int translateModifiers(Qt::KeyboardModifiers state, const QString &text)
The QKeySequenceEdit widget allows to input a QKeySequence.
QT_REQUIRE_CONFIG(keysequenceedit)