mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
clean: deprecated QKeySequence[]->int
; answer ikm's question from 2009
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
This commit is contained in:
parent
8d0859b932
commit
8ad7291147
|
@ -102,32 +102,24 @@ AnkiConnectServer::AnkiConnectServer():
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
HotKey::HotKey():
|
|
||||||
modifiers( 0 ),
|
|
||||||
key1( 0 ),
|
|
||||||
key2( 0 )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Does anyone know how to separate modifiers from the keycode? We'll
|
|
||||||
// use our own mask.
|
|
||||||
|
|
||||||
uint32_t const keyMask = 0x01FFFFFF;
|
|
||||||
|
|
||||||
HotKey::HotKey( QKeySequence const & seq ):
|
HotKey::HotKey( QKeySequence const & seq ):
|
||||||
modifiers( seq[ 0 ] & ~keyMask ),
|
modifiers( seq[ 0 ].keyboardModifiers() ),
|
||||||
key1( seq[ 0 ] & keyMask ),
|
key1( seq[ 0 ].key() ),
|
||||||
key2( seq[ 1 ] & keyMask )
|
key2( seq[ 1 ].key() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeySequence HotKey::toKeySequence() const
|
QKeySequence HotKey::toKeySequence() const
|
||||||
{
|
{
|
||||||
int v2 = key2 ? ( key2 | modifiers ) : 0;
|
if ( key2 != 0 || key2 != Qt::Key::Key_unknown ) {
|
||||||
|
return { QKeyCombination( modifiers, static_cast< Qt::Key >( key1 ) ),
|
||||||
return QKeySequence( key1 | modifiers, v2 );
|
QKeyCombination( modifiers, static_cast< Qt::Key >( key2 ) ) };
|
||||||
|
}
|
||||||
|
return { QKeyCombination( modifiers, static_cast< Qt::Key >( key1 ) ) };
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InternalPlayerBackend::anyAvailable()
|
bool InternalPlayerBackend::anyAvailable()
|
||||||
{
|
{
|
||||||
#if defined( MAKE_FFMPEG_PLAYER ) || defined( MAKE_QTMULTIMEDIA_PLAYER )
|
#if defined( MAKE_FFMPEG_PLAYER ) || defined( MAKE_QTMULTIMEDIA_PLAYER )
|
||||||
|
|
|
@ -192,14 +192,11 @@ struct HotKey
|
||||||
Qt::KeyboardModifiers modifiers;
|
Qt::KeyboardModifiers modifiers;
|
||||||
int key1, key2;
|
int key1, key2;
|
||||||
|
|
||||||
HotKey();
|
|
||||||
|
|
||||||
/// Hotkey's constructor, take a QKeySequence's first two keys
|
/// Hotkey's constructor, take a QKeySequence's first two keys
|
||||||
/// 1st key's modifier will be the `modifiers` above
|
/// 1st key's modifier will be the `modifiers` above
|
||||||
/// 1st key without modifier will becomes `key1`
|
/// 1st key without modifier will becomes `key1`
|
||||||
/// 2nd key without modifier will becomes `key2`
|
/// 2nd key without modifier will becomes `key2`
|
||||||
/// The relation between the int and qt's KeyCode should consult qt's doc
|
/// The relation between the int and qt's KeyCode should consult qt's doc
|
||||||
|
|
||||||
HotKey( QKeySequence const & );
|
HotKey( QKeySequence const & );
|
||||||
|
|
||||||
QKeySequence toKeySequence() const;
|
QKeySequence toKeySequence() const;
|
||||||
|
|
Loading…
Reference in a new issue