/usr/include/KF5/KGuiAddons/kmodifierkeyinfo.h is in libkf5guiaddons-dev 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /*
Copyright 2009 Michael Leupold <lemma@confuego.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KMODIFIERKEYINFO_H
#define KMODIFIERKEYINFO_H
#include <kguiaddons_export.h>
#include <QtCore/QObject>
class KModifierKeyInfoProvider;
/**
* @class KModifierKeyInfo kmodifierkeyinfo.h KModifierKeyInfo
*
* Get information about the state of the keyboard's modifier keys.
*
* This class provides cross-platform information about the state of the
* keyboard's modifier keys and the mouse buttons and allows to change the
* state as well.
*
* It recognizes two states a key can be in:
* <ul><li><i>locked</i>: eg. caps-locked (aka toggled)</li>
* <li><i>latched</i>: the key is temporarily locked but will be unlocked upon
* the next keypress.</li></ul>
*
* An application can either query the states synchronously (@see isKeyLatched,
* @see isKeyLocked) or connect to KModifierKeyInfo's signals to be notified about
* changes (@see keyLatched, @see keyLocked).
*/
class KGUIADDONS_EXPORT KModifierKeyInfo : public QObject
{
Q_OBJECT
public:
/**
* Default constructor
*/
KModifierKeyInfo(QObject *parent = nullptr);
/**
* Destructor
*/
virtual ~KModifierKeyInfo();
/**
* Check if a key is known by the underlying window system and can be queried.
*
* @param key The key to check
* @return true if the key is available, false if it is unknown
*/
bool knowsKey(Qt::Key key) const;
/**
* Get a list of known keys.
*
* @return A list of known keys of which states will be reported.
*/
const QList<Qt::Key> knownKeys() const;
/**
* Synchronously check if a key is pressed.
*
* @param key The key to check
* @return true if the key is pressed, false if the key is not pressed or unknown.
* @see isKeyLatched, @see isKeyLocked, @see keyPressed
*/
bool isKeyPressed(Qt::Key key) const;
/**
* Synchronously check if a key is latched.
*
* @param key The key to check
* @return true if the key is latched, false if the key is not latched or unknown.
* @see isKeyPressed, @see isKeyLocked, @see keyLatched
*/
bool isKeyLatched(Qt::Key key) const;
/**
* Set the latched state of a key.
*
* @param key The key to latch
* @param latched true to latch the key, false to unlatch it.
* @return false if the key is unknown. true doesn't guarantee you the
* operation worked.
*/
bool setKeyLatched(Qt::Key key, bool latched);
/**
* Synchronously check if a key is locked.
*
* @param key The key to check
* @return true if the key is locked, false if the key is not locked or unknown.
* @see isKeyPressed, @see isKeyLatched, @see keyLocked
*/
bool isKeyLocked(Qt::Key key) const;
/**
* Set the locked state of a key.
*
* @param key The key to lock
* @param latched true to lock the key, false to unlock it.
* @return false if the key is unknown. true doesn't guarantee you the
* operation worked.
*/
bool setKeyLocked(Qt::Key key, bool locked);
/**
* Synchronously check if a mouse button is pressed.
*
* @param button The mouse button to check
* @return true if the mouse button is pressed, false if the mouse button
* is not pressed or its state is unknown.
*/
bool isButtonPressed(Qt::MouseButton button) const;
Q_SIGNALS:
/**
* This signal is emitted whenever the pressed state of a key changes
* (key press or key release).
*
* @param key The key that changed state
* @param pressed true if the key is now pressed, false if is released.
*/
void keyPressed(Qt::Key key, bool pressed);
/**
* This signal is emitted whenever the latched state of a key changes.
*
* @param key The key that changed state
* @param latched true if the key is now latched, false if it isn't
*/
void keyLatched(Qt::Key key, bool latched);
/**
* This signal is emitted whenever the locked state of a key changes.
*
* @param key The key that changed state
* @param locked true if the key is now locked, false if it isn't
*/
void keyLocked(Qt::Key key, bool locked);
/**
* This signal is emitted whenever the pressed state of a mouse button
* changes (mouse button press or release).
*
* @param button The mouse button that changed state
* @param pressed true if the mouse button is now pressed, false if
* is released.
*/
void buttonPressed(Qt::MouseButton button, bool pressed);
/**
* This signal is emitted whenever a new modifier is found due to
* the keyboard mapping changing.
*
* @param key The key that was discovered
*/
void keyAdded(Qt::Key key);
/**
* This signal is emitted whenever a previously known modifier no
* longer exists due to the keyboard mapping changing.
*
* @param key The key that vanished
*/
void keyRemoved(Qt::Key key);
private:
Q_DISABLE_COPY(KModifierKeyInfo)
KModifierKeyInfoProvider *const p; // krazy:exclude=dpointer
};
#endif
|