KDeclarative

keysequencehelper.h
1/*
2 SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org>
3 SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef KEYSEQUENCEHELPER_H
9#define KEYSEQUENCEHELPER_H
10
11#include <KKeySequenceRecorder>
12
13#include <QKeySequence>
14#include <QQuickItem>
15
16#include "enums.h"
17
18class KeySequenceHelperPrivate;
19class QQuickWindow;
20
21class KeySequenceHelper : public KKeySequenceRecorder
22{
24 QML_ELEMENT
25
26 Q_PROPERTY(KeySequenceEnums::ShortcutTypes checkAgainstShortcutTypes READ checkAgainstShortcutTypes WRITE setCheckAgainstShortcutTypes NOTIFY
27 checkAgainstShortcutTypesChanged)
28
29public:
30 /**
31 * Constructor.
32 */
33 explicit KeySequenceHelper(QObject *parent = nullptr);
34
35 /**
36 * Destructs the widget.
37 */
38 ~KeySequenceHelper() override;
39
40 Q_INVOKABLE void updateKeySequence(const QKeySequence &keySequence);
41
42 Q_INVOKABLE void showQuestionDialog(const QString &title, const QString &text);
43 Q_INVOKABLE void showErrorDialog(const QString &title, const QString &text);
44
45 KeySequenceEnums::ShortcutTypes checkAgainstShortcutTypes();
46 void setCheckAgainstShortcutTypes(KeySequenceEnums::ShortcutTypes types);
47
48 Q_INVOKABLE static bool keySequenceIsEmpty(const QKeySequence &keySequence);
49 Q_INVOKABLE static QString keySequenceNativeText(const QKeySequence &keySequence);
50 Q_INVOKABLE static QWindow *renderWindow(QQuickWindow *quickWindow);
51
53 void checkAgainstShortcutTypesChanged();
54 void questionDialogAccepted();
55 void questionDialogRejected();
56
57private:
58 friend class KeySequenceHelperPrivate;
59 KeySequenceHelperPrivate *const d;
60
61 Q_DISABLE_COPY(KeySequenceHelper)
62};
63
64#endif // KEYSEQUENCEHELPER_H
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:47:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.