summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r--src/widgets/kernel/qapplication.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index a8ac1a1bc0..e597760a61 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3172,7 +3172,7 @@ bool QApplication::desktopSettingsAware()
one of the above events. If no keys are being held Qt::NoModifier is
returned.
- \sa mouseButtons()
+ \sa mouseButtons(), queryKeyboardModifiers()
*/
Qt::KeyboardModifiers QApplication::keyboardModifiers()
@@ -3181,6 +3181,31 @@ Qt::KeyboardModifiers QApplication::keyboardModifiers()
}
/*!
+ \fn Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+
+ Queries and returns the state of the modifier keys on the keyboard.
+ Unlike keyboardModifiers, this method returns the actual keys held
+ on the input device at the time of calling the method.
+
+ It does not rely on the keypress events having been received by this
+ process, which makes it possible to check the modifiers while moving
+ a window, for instance. Note that in most cases, you should use
+ keyboardModifiers(), which is faster and more accurate since it contains
+ the state of the modifiers as they were when the currently processed
+ event was received.
+
+ \sa keyboardModifiers()
+
+ \since 4.8
+*/
+
+Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+{
+ qWarning("queryKeyboardModifiers() doesn't have a QPA implementation");
+ return QApplicationPrivate::modifier_buttons;
+}
+
+/*!
Returns the current state of the buttons on the mouse. The current state is
updated syncronously as the event queue is emptied of events that will
spontaneously change the mouse state (QEvent::MouseButtonPress and