Kirigami2

inputmethod.h
1 /*
2  * SPDX-FileCopyrightText: 2021 Arjen Hiemstra <[email protected]>
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 
14 /**
15  * This exposes information about the current used input method.
16  */
17 class InputMethod : public QObject
18 {
19  Q_OBJECT
20 
21 public:
22  InputMethod(QObject *parent = nullptr);
23  ~InputMethod() override;
24 
25  /**
26  * Is an input method available?
27  *
28  * This will be true if there is an input method available. When it is
29  * false it means there's no special input method configured and input
30  * happens directly through keyboard events.
31  */
32  Q_PROPERTY(bool available READ available NOTIFY availableChanged)
33  bool available() const;
34  Q_SIGNAL void availableChanged();
35 
36  /**
37  * Is the current input method enabled?
38  *
39  * If this is false, that means the input method is available but not in use.
40  */
41  Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
42  bool enabled() const;
43  void setEnabled(bool newEnabled);
44  Q_SIGNAL void enabledChanged();
45 
46  /**
47  * Is the current input method active?
48  *
49  * What active means depends on the type of input method. In case of a
50  * virtual keyboard for example, it would mean the virtual keyboard is
51  * visible.
52  */
53  Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
54  bool active() const;
55  void setActive(bool newActive);
56  Q_SIGNAL void activeChanged();
57 
58  /**
59  * Is the current input method visible?
60  *
61  * For some input methods this will match \ref active however for others this
62  * may differ.
63  */
64  Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
65  bool visible() const;
66  Q_SIGNAL void visibleChanged();
67 
68  /**
69  * Will the input method be shown when a text input field gains focus?
70  *
71  * This is intended to be used to decide whether to give an input field
72  * default focus. For certain input methods, like virtual keyboards, it may
73  * not be desirable to show it by default. For example, having a search
74  * field focused on application startup may cause the virtual keyboard to
75  * show, greatly reducing the available application space.
76  */
77  Q_PROPERTY(bool willShowOnActive READ willShowOnActive NOTIFY willShowOnActiveChanged)
78  bool willShowOnActive() const;
79  Q_SIGNAL void willShowOnActiveChanged();
80 
81 private:
82  class Private;
83  const std::unique_ptr<Private> d;
84 };
85 
86 #endif // INPUTMETHOD_H
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
bool visible
Is the current input method visible?
Definition: inputmethod.h:64
bool enabled
Is the current input method enabled?
Definition: inputmethod.h:41
Q_SIGNALQ_SIGNAL
bool willShowOnActive
Will the input method be shown when a text input field gains focus?
Definition: inputmethod.h:77
bool active
Is the current input method active?
Definition: inputmethod.h:53
This exposes information about the current used input method.
Definition: inputmethod.h:17
bool available
Is an input method available?
Definition: inputmethod.h:32
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 04:11:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.