Kirigami2

inputmethod.h
1/*
2 * SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef INPUTMETHOD_H
8#define INPUTMETHOD_H
9
10#include <memory>
11
12#include <QObject>
13#include <qqmlregistration.h>
14
15#include "kirigamiplatform_export.h"
16
17namespace Kirigami
18{
19namespace Platform
20{
21
22/**
23 * This exposes information about the current used input method.
24 */
25class KIRIGAMIPLATFORM_EXPORT InputMethod : public QObject
26{
27 Q_OBJECT
28 QML_ELEMENT
29 QML_SINGLETON
30
31public:
32 InputMethod(QObject *parent = nullptr);
33 ~InputMethod() override;
34
35 /**
36 * Is an input method available?
37 *
38 * This will be true if there is an input method available. When it is
39 * false it means there's no special input method configured and input
40 * happens directly through keyboard events.
41 */
42 Q_PROPERTY(bool available READ available NOTIFY availableChanged FINAL)
43 bool available() const;
44 Q_SIGNAL void availableChanged();
45
46 /**
47 * Is the current input method enabled?
48 *
49 * If this is false, that means the input method is available but not in use.
50 */
51 Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged FINAL)
52 bool enabled() const;
53 Q_SIGNAL void enabledChanged();
54
55 /**
56 * Is the current input method active?
57 *
58 * What active means depends on the type of input method. In case of a
59 * virtual keyboard for example, it would mean the virtual keyboard is
60 * visible.
61 */
62 Q_PROPERTY(bool active READ active NOTIFY activeChanged FINAL)
63 bool active() const;
64 Q_SIGNAL void activeChanged();
65
66 /**
67 * Is the current input method visible?
68 *
69 * For some input methods this will match \ref active however for others this
70 * may differ.
71 */
72 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged FINAL)
73 bool visible() const;
74 Q_SIGNAL void visibleChanged();
75
76 /**
77 * Will the input method be shown when a text input field gains focus?
78 *
79 * This is intended to be used to decide whether to give an input field
80 * default focus. For certain input methods, like virtual keyboards, it may
81 * not be desirable to show it by default. For example, having a search
82 * field focused on application startup may cause the virtual keyboard to
83 * show, greatly reducing the available application space.
84 */
85 Q_PROPERTY(bool willShowOnActive READ willShowOnActive NOTIFY willShowOnActiveChanged FINAL)
86 bool willShowOnActive() const;
87 Q_SIGNAL void willShowOnActiveChanged();
88
89private:
90 class Private;
91 const std::unique_ptr<Private> d;
92};
93
94}
95}
96
97#endif // INPUTMETHOD_H
This exposes information about the current used input method.
Definition inputmethod.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:51:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.