goldendict-ng/src/keyboardstate.cc
xiaoyifang 15cb327bbd
opt: rewrite keymodifier (#1614)
* opt: rewrite keyboardstate.cc


---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-06-26 15:58:42 +08:00

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 ) ) ) );
}