mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
15cb327bbd
* opt: rewrite keyboardstate.cc --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
16 lines
557 B
C++
16 lines
557 B
C++
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
#include "keyboardstate.hh"
|
|
|
|
#include <QApplication>
|
|
|
|
bool KeyboardState::checkModifiersPressed( int mask )
|
|
{
|
|
auto modifiers = QApplication::queryKeyboardModifiers();
|
|
|
|
return !( ( mask & Alt && !( modifiers.testFlag( Qt::AltModifier ) ) )
|
|
|| ( mask & Ctrl && !( modifiers.testFlag( Qt::ControlModifier ) ) )
|
|
|| ( mask & Shift && !( modifiers.testFlag( Qt::ShiftModifier ) ) ) );
|
|
}
|