Compare commits

...

3 commits

Author SHA1 Message Date
shenleban tongying c5d682c993
clean: fix some issues found by the code analysis of Visual Studio
Some checks failed
SonarCloud / Build and analyze (push) Has been cancelled
2024-11-14 12:24:46 +00:00
shenleban tongying 0f71f32ad4
refactor: move most of the Windows specific code out of hotkeywrapper.cc 2024-11-14 11:12:17 +00:00
shenleban tongying 5cc43a3dc8
fix: windows global hotkey Win/Meta and 1-9 doesn't work 2024-11-14 09:06:23 +00:00
9 changed files with 317 additions and 329 deletions

View file

@ -492,7 +492,7 @@ struct WebSite
QString id, name, url; QString id, name, url;
bool enabled; bool enabled;
QString iconFilename; QString iconFilename;
bool inside_iframe; bool inside_iframe = false;
WebSite(): WebSite():
enabled( false ) enabled( false )
@ -698,7 +698,7 @@ struct Transliteration
struct Lingua struct Lingua
{ {
bool enable; bool enable = false;
QString languageCodes; QString languageCodes;
bool operator==( Lingua const & other ) const bool operator==( Lingua const & other ) const
@ -737,13 +737,16 @@ struct Forvo
struct Program struct Program
{ {
bool enabled; bool enabled;
// NOTE: the value of this enum is used for config
enum Type { enum Type {
Audio, Invalid = -1, // Init value
PlainText, Audio = 0,
Html, PlainText = 1,
PrefixMatch, Html = 2,
MaxTypeValue PrefixMatch = 3,
} type; MaxTypeValue = 4
};
Type type = Invalid;
QString id, name, commandLine; QString id, name, commandLine;
QString iconFilename; QString iconFilename;
@ -892,7 +895,7 @@ struct Class
QString articleSavePath; // Path to save articles QString articleSavePath; // Path to save articles
bool pinPopupWindow; // Last pin status bool pinPopupWindow; // Last pin status
bool popupWindowAlwaysOnTop; // Last status of pinned popup window bool popupWindowAlwaysOnTop = false; // Last status of pinned popup window
QByteArray mainWindowState; // Binary state saved by QMainWindow QByteArray mainWindowState; // Binary state saved by QMainWindow
QByteArray mainWindowGeometry; // Geometry saved by QMainWindow QByteArray mainWindowGeometry; // Geometry saved by QMainWindow
@ -929,7 +932,7 @@ struct Class
Group const * getGroup( unsigned id ) const; Group const * getGroup( unsigned id ) const;
//disable tts dictionary. does not need to save to persistent file //disable tts dictionary. does not need to save to persistent file
bool notts = false; bool notts = false;
bool resetState; bool resetState = false;
}; };
/// Configuration-specific events. Some parts of the program need to react /// Configuration-specific events. Some parts of the program need to react

View file

@ -45,9 +45,9 @@ DEF_EX( exCorruptedChainData, "Corrupted chain data in the leaf of a btree encou
struct WordArticleLink struct WordArticleLink
{ {
string word, prefix; // in utf8 string word, prefix; // in utf8
uint32_t articleOffset; uint32_t articleOffset = 0;
WordArticleLink() {} WordArticleLink() = default;
WordArticleLink( string const & word_, uint32_t articleOffset_, string const & prefix_ = string() ): WordArticleLink( string const & word_, uint32_t articleOffset_, string const & prefix_ = string() ):
word( word_ ), word( word_ ),

View file

@ -102,8 +102,7 @@ string convert( string const & in,
} }
break; break;
} }
// Fall-through [[fallthrough]];
default: default:
inConverted.push_back( i ); inConverted.push_back( i );
afterEol = false; afterEol = false;

View file

@ -1,17 +1,10 @@
#ifdef __WIN32 // Q_OS_WIN32 isn't available at this point
#define _WIN32_WINNT 0x0430
#include <windows.h>
#endif
#include "hotkeywrapper.hh" #include "hotkeywrapper.hh"
#include "gddebug.hh" #include "gddebug.hh"
#include <QSessionManager>
#include <QTimer> #include <QTimer>
#include <QSessionManager>
#include <QWidget> #include <QWidget>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include "mainwindow.hh" #include <windows.h>
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -100,11 +93,6 @@ HotkeyStruct::HotkeyStruct( quint32 key_, quint32 key2_, quint32 modifier_, int
modifier( modifier_ ), modifier( modifier_ ),
handle( handle_ ), handle( handle_ ),
id( id_ ) id( id_ )
#ifdef Q_OS_MAC
,
hkRef( 0 ),
hkRef2( 0 )
#endif
{ {
} }
@ -115,14 +103,7 @@ HotkeyWrapper::HotkeyWrapper( QObject * parent ):
QThread( parent ), QThread( parent ),
state2( false ) state2( false )
{ {
#ifdef Q_OS_WIN
hwnd = (HWND)( ( static_cast< QMainWindow * >( parent ) )->winId() );
gdDebug( "Handle global hotkeys via RegisterHotkey()" );
#else
init(); init();
#endif
( static_cast< QHotkeyApplication * >( qApp ) )->registerWrapper( this ); ( static_cast< QHotkeyApplication * >( qApp ) )->registerWrapper( this );
} }
@ -164,7 +145,8 @@ bool HotkeyWrapper::checkState( quint32 vk, quint32 mod )
if ( hs.key == vk && hs.modifier == mod ) { if ( hs.key == vk && hs.modifier == mod ) {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
// If that was a copy-to-clipboard shortcut, re-emit it back so it could
// reach its original destination so it could be acted upon.
if ( hs.key2 != 0 || ( mod == MOD_CONTROL && ( vk == VK_INSERT || vk == 'c' || vk == 'C' ) ) ) { if ( hs.key2 != 0 || ( mod == MOD_CONTROL && ( vk == VK_INSERT || vk == 'c' || vk == 'C' ) ) ) {
// Pass-through first part of compound hotkey or clipdoard copy command // Pass-through first part of compound hotkey or clipdoard copy command
@ -270,262 +252,8 @@ bool HotkeyWrapper::checkState( quint32 vk, quint32 mod )
return false; return false;
} }
//////////////////////////////////////////////////////////////////////////
#ifdef Q_OS_WIN #ifndef Q_OS_WIN
void HotkeyWrapper::init()
{
QWidget * root = qApp->topLevelWidgets().value( 0 );
hwnd = (HWND)root->winId();
}
bool HotkeyWrapper::setGlobalKey( QKeySequence const & seq, int handle )
{
Config::HotKey hk( seq );
return setGlobalKey( hk.key1, hk.key2, hk.modifiers, handle );
}
bool HotkeyWrapper::setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle )
{
if ( !key )
return false; // We don't monitor empty combinations
static int id = 0;
if ( id > 0xBFFF - 1 )
id = 0;
quint32 mod = 0;
if ( modifier & Qt::CTRL )
mod |= MOD_CONTROL;
if ( modifier & Qt::ALT )
mod |= MOD_ALT;
if ( modifier & Qt::SHIFT )
mod |= MOD_SHIFT;
if ( modifier & Qt::META )
mod |= MOD_WIN;
quint32 vk = nativeKey( key );
quint32 vk2 = key2 ? nativeKey( key2 ) : 0;
hotkeys.append( HotkeyStruct( vk, vk2, mod, handle, id ) );
if ( !RegisterHotKey( hwnd, id++, mod, vk ) )
return false;
if ( key2 && key2 != key )
return RegisterHotKey( hwnd, id++, mod, vk2 );
return true;
}
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
bool HotkeyWrapper::winEvent( MSG * message, long * result )
#else
bool HotkeyWrapper::winEvent( MSG * message, qintptr * result )
#endif
{
(void)result;
if ( message->message == WM_HOTKEY )
return checkState( ( message->lParam >> 16 ), ( message->lParam & 0xffff ) );
return false;
}
quint32 HotkeyWrapper::nativeKey( int key )
{
if ( key >= Qt::Key_0 && key <= Qt::Key_9 )
return VK_NUMPAD0 + ( key - Qt::Key_0 );
if ( key >= Qt::Key_A && key <= Qt::Key_Z )
return key;
switch ( key ) {
case Qt::Key_Space:
return VK_SPACE;
case Qt::Key_Asterisk:
return VK_MULTIPLY;
case Qt::Key_Plus:
return VK_ADD;
case Qt::Key_Comma:
return VK_SEPARATOR;
case Qt::Key_Minus:
return VK_SUBTRACT;
case Qt::Key_Slash:
return VK_DIVIDE;
case Qt::Key_Tab:
case Qt::Key_Backtab:
return VK_TAB;
case Qt::Key_Backspace:
return VK_BACK;
case Qt::Key_Return:
case Qt::Key_Escape:
return VK_ESCAPE;
case Qt::Key_Enter:
return VK_RETURN;
case Qt::Key_Insert:
return VK_INSERT;
case Qt::Key_Delete:
return VK_DELETE;
case Qt::Key_Pause:
return VK_PAUSE;
case Qt::Key_Print:
return VK_PRINT;
case Qt::Key_Clear:
return VK_CLEAR;
case Qt::Key_Home:
return VK_HOME;
case Qt::Key_End:
return VK_END;
case Qt::Key_Up:
return VK_UP;
case Qt::Key_Down:
return VK_DOWN;
case Qt::Key_Left:
return VK_LEFT;
case Qt::Key_Right:
return VK_RIGHT;
case Qt::Key_PageUp:
return VK_PRIOR;
case Qt::Key_PageDown:
return VK_NEXT;
case Qt::Key_F1:
return VK_F1;
case Qt::Key_F2:
return VK_F2;
case Qt::Key_F3:
return VK_F3;
case Qt::Key_F4:
return VK_F4;
case Qt::Key_F5:
return VK_F5;
case Qt::Key_F6:
return VK_F6;
case Qt::Key_F7:
return VK_F7;
case Qt::Key_F8:
return VK_F8;
case Qt::Key_F9:
return VK_F9;
case Qt::Key_F10:
return VK_F10;
case Qt::Key_F11:
return VK_F11;
case Qt::Key_F12:
return VK_F12;
case Qt::Key_F13:
return VK_F13;
case Qt::Key_F14:
return VK_F14;
case Qt::Key_F15:
return VK_F15;
case Qt::Key_F16:
return VK_F16;
case Qt::Key_F17:
return VK_F17;
case Qt::Key_F18:
return VK_F18;
case Qt::Key_F19:
return VK_F19;
case Qt::Key_F20:
return VK_F20;
case Qt::Key_F21:
return VK_F21;
case Qt::Key_F22:
return VK_F22;
case Qt::Key_F23:
return VK_F23;
case Qt::Key_F24:
return VK_F24;
case Qt::Key_Colon:
case Qt::Key_Semicolon:
return VK_OEM_1;
case Qt::Key_Question:
return VK_OEM_2;
case Qt::Key_AsciiTilde:
case Qt::Key_QuoteLeft:
return VK_OEM_3;
case Qt::Key_BraceLeft:
case Qt::Key_BracketLeft:
return VK_OEM_4;
case Qt::Key_Bar:
case Qt::Key_Backslash:
return VK_OEM_5;
case Qt::Key_BraceRight:
case Qt::Key_BracketRight:
return VK_OEM_6;
case Qt::Key_QuoteDbl:
case Qt::Key_Apostrophe:
return VK_OEM_7;
case Qt::Key_Less:
return VK_OEM_COMMA;
case Qt::Key_Greater:
return VK_OEM_PERIOD;
case Qt::Key_Equal:
return VK_OEM_PLUS;
case Qt::Key_ParenRight:
return 0x30;
case Qt::Key_Exclam:
return 0x31;
case Qt::Key_At:
return 0x32;
case Qt::Key_NumberSign:
return 0x33;
case Qt::Key_Dollar:
return 0x34;
case Qt::Key_Percent:
return 0x35;
case Qt::Key_AsciiCircum:
return 0x36;
case Qt::Key_Ampersand:
return 0x37;
case Qt::Key_copyright:
return 0x38;
case Qt::Key_ParenLeft:
return 0x39;
case Qt::Key_Underscore:
return VK_OEM_MINUS;
default:;
}
return key;
}
void HotkeyWrapper::unregister()
{
for ( int i = 0; i < hotkeys.count(); i++ ) {
HotkeyStruct const & hk = hotkeys.at( i );
UnregisterHotKey( hwnd, hk.id );
if ( hk.key2 && hk.key2 != hk.key )
UnregisterHotKey( hwnd, hk.id + 1 );
}
( static_cast< QHotkeyApplication * >( qApp ) )->unregisterWrapper( this );
}
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
bool QHotkeyApplication::nativeEventFilter( const QByteArray & /*eventType*/, void * message, long * result )
#else
bool QHotkeyApplication::nativeEventFilter( const QByteArray & /*eventType*/, void * message, qintptr * result )
#endif
{
MSG * msg = reinterpret_cast< MSG * >( message );
if ( msg->message == WM_HOTKEY ) {
for ( int i = 0; i < hotkeyWrappers.size(); i++ ) {
if ( hotkeyWrappers.at( i )->winEvent( msg, result ) )
return true;
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////
#else
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View file

@ -1,5 +1,12 @@
#pragma once #pragma once
/// @file
/// Handling global hotkeys and some tricks
/// Part of this header are implmented in
/// + `winhotkeywrapper.cc`
/// + `machotkeywrapper.hh`
///
#include <QGuiApplication> #include <QGuiApplication>
#include <QThread> #include <QThread>
@ -37,15 +44,17 @@
struct HotkeyStruct struct HotkeyStruct
{ {
HotkeyStruct() {} HotkeyStruct() = default;
HotkeyStruct( quint32 key, quint32 key2, quint32 modifier, int handle, int id ); HotkeyStruct( quint32 key, quint32 key2, quint32 modifier, int handle, int id );
quint32 key, key2; quint32 key = 0;
quint32 modifier; quint32 key2 = 0;
int handle; quint32 modifier = 0;
int id; int handle = 0;
int id = 0;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
EventHotKeyRef hkRef, hkRef2; EventHotKeyRef hkRef = 0;
EventHotKeyRef hkRef2 = 0;
#endif #endif
}; };
@ -98,15 +107,11 @@ private:
HotkeyStruct state2waiter; HotkeyStruct state2waiter;
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
virtual bool winEvent( MSG * message, long * result );
#else
virtual bool winEvent( MSG * message, qintptr * result ); virtual bool winEvent( MSG * message, qintptr * result );
#endif
HWND hwnd; HWND hwnd;
#endif
#elif defined( Q_OS_MAC ) #ifdef Q_OS_MAC
public: public:
void activated( int hkId ); void activated( int hkId );
@ -117,9 +122,9 @@ private:
static EventHandlerUPP hotKeyFunction; static EventHandlerUPP hotKeyFunction;
quint32 keyC; quint32 keyC;
EventHandlerRef handlerRef; EventHandlerRef handlerRef;
#endif
#else #ifdef HAVE_X11
static void recordEventCallback( XPointer, XRecordInterceptData * ); static void recordEventCallback( XPointer, XRecordInterceptData * );
/// Called by recordEventCallback() /// Called by recordEventCallback()
@ -205,16 +210,10 @@ protected:
void registerWrapper( HotkeyWrapper * wrapper ); void registerWrapper( HotkeyWrapper * wrapper );
void unregisterWrapper( HotkeyWrapper * wrapper ); void unregisterWrapper( HotkeyWrapper * wrapper );
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
virtual bool nativeEventFilter( const QByteArray & eventType, void * message, long * result );
#else
virtual bool nativeEventFilter( const QByteArray & eventType, void * message, qintptr * result ); virtual bool nativeEventFilter( const QByteArray & eventType, void * message, qintptr * result );
#endif #endif
protected:
#endif // Q_OS_WIN32
QList< HotkeyWrapper * > hotkeyWrappers; QList< HotkeyWrapper * > hotkeyWrappers;
}; };

View file

@ -341,8 +341,11 @@ int main( int argc, char ** argv )
// attach the new console to this application's process // attach the new console to this application's process
if ( AttachConsole( ATTACH_PARENT_PROCESS ) ) { if ( AttachConsole( ATTACH_PARENT_PROCESS ) ) {
// reopen the std I/O streams to redirect I/O to the new console // reopen the std I/O streams to redirect I/O to the new console
freopen( "CON", "w", stdout ); auto ret1 = freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr ); auto ret2 = freopen( "CON", "w", stderr );
if ( ret1 == nullptr || ret2 == nullptr ) {
qDebug() << "Attaching console stdout or stderr failed";
}
} }
qputenv( "QT_QPA_PLATFORM", "windows:darkmode=1" ); qputenv( "QT_QPA_PLATFORM", "windows:darkmode=1" );

View file

@ -84,13 +84,13 @@ private slots:
private: private:
virtual bool eventFilter( QObject *, QEvent * ); virtual bool eventFilter( QObject *, QEvent * );
Config::Class * m_cfg; Config::Class * m_cfg = nullptr;
QTreeView * m_favoritesTree; QTreeView * m_favoritesTree = nullptr;
QMenu * m_favoritesMenu; QMenu * m_favoritesMenu = nullptr;
QAction * m_deleteSelectedAction; QAction * m_deleteSelectedAction = nullptr;
QAction * m_separator; QAction * m_separator = nullptr;
QAction * m_copySelectedToClipboard; QAction * m_copySelectedToClipboard = nullptr;
QAction * m_addFolder; QAction * m_addFolder = nullptr;
QWidget favoritesPaneTitleBar; QWidget favoritesPaneTitleBar;
QHBoxLayout favoritesPaneTitleBarLayout; QHBoxLayout favoritesPaneTitleBarLayout;

View file

@ -53,13 +53,13 @@ private slots:
private: private:
virtual bool eventFilter( QObject *, QEvent * ); virtual bool eventFilter( QObject *, QEvent * );
Config::Class * m_cfg; Config::Class * m_cfg = nullptr;
History * m_history; History * m_history = nullptr;
QListView * m_historyList; QListView * m_historyList = nullptr;
QMenu * m_historyMenu; QMenu * m_historyMenu = nullptr;
QAction * m_deleteSelectedAction; QAction * m_deleteSelectedAction = nullptr;
QAction * m_separator; QAction * m_separator = nullptr;
QAction * m_copySelectedToClipboard; QAction * m_copySelectedToClipboard = nullptr;
QWidget historyPaneTitleBar; QWidget historyPaneTitleBar;
QHBoxLayout historyPaneTitleBarLayout; QHBoxLayout historyPaneTitleBarLayout;

View file

@ -0,0 +1,256 @@
#include <QtGlobal>
#ifdef Q_OS_WIN
#include "hotkeywrapper.hh"
#include <windows.h>
#include <QWidget>
/// Implementation is pretty much using RegisterHotKey & UnregisterHotKey
/// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey
void HotkeyWrapper::init()
{
hwnd = (HWND)( ( static_cast< QWidget * >( this->parent() ) )->winId() );
}
bool HotkeyWrapper::setGlobalKey( QKeySequence const & seq, int handle )
{
Config::HotKey hk( seq );
return setGlobalKey( hk.key1, hk.key2, hk.modifiers, handle );
}
bool HotkeyWrapper::setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier, int handle )
{
if ( !key )
return false; // We don't monitor empty combinations
static int id = 0;
if ( id > 0xBFFF - 1 )
id = 0;
quint32 mod = 0;
if ( modifier & Qt::CTRL )
mod |= MOD_CONTROL;
if ( modifier & Qt::ALT )
mod |= MOD_ALT;
if ( modifier & Qt::SHIFT )
mod |= MOD_SHIFT;
if ( modifier & Qt::META )
mod |= MOD_WIN;
quint32 vk = nativeKey( key );
quint32 vk2 = key2 ? nativeKey( key2 ) : 0;
hotkeys.append( HotkeyStruct( vk, vk2, mod, handle, id ) );
if ( !RegisterHotKey( hwnd, id++, mod, vk ) )
return false;
if ( key2 && key2 != key )
return RegisterHotKey( hwnd, id++, mod, vk2 );
return true;
}
bool HotkeyWrapper::winEvent( MSG * message, qintptr * result )
{
Q_UNUSED( result );
if ( message->message == WM_HOTKEY )
return checkState( ( message->lParam >> 16 ), ( message->lParam & 0xffff ) );
return false;
}
void HotkeyWrapper::unregister()
{
for ( int i = 0; i < hotkeys.count(); i++ ) {
HotkeyStruct const & hk = hotkeys.at( i );
UnregisterHotKey( hwnd, hk.id );
if ( hk.key2 && hk.key2 != hk.key )
UnregisterHotKey( hwnd, hk.id + 1 );
}
( static_cast< QHotkeyApplication * >( qApp ) )->unregisterWrapper( this );
}
bool QHotkeyApplication::nativeEventFilter( const QByteArray & /*eventType*/, void * message, qintptr * result )
{
MSG * msg = reinterpret_cast< MSG * >( message );
if ( msg->message == WM_HOTKEY ) {
for ( int i = 0; i < hotkeyWrappers.size(); i++ ) {
if ( hotkeyWrappers.at( i )->winEvent( msg, result ) )
return true;
}
}
return false;
}
/// References:
/// https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
/// https://doc.qt.io/qt-6/qt.html#Key-enum
quint32 HotkeyWrapper::nativeKey( int key )
{
// Qt's 0-9 & A-Z overlaps with Windows's VK
if ( key >= Qt::Key_0 && key <= Qt::Key_9 || key >= Qt::Key_A && key <= Qt::Key_Z ) {
return key;
}
switch ( key ) {
case Qt::Key_Space:
return VK_SPACE;
case Qt::Key_Asterisk:
return VK_MULTIPLY;
case Qt::Key_Plus:
return VK_ADD;
case Qt::Key_Comma:
return VK_SEPARATOR;
case Qt::Key_Minus:
return VK_SUBTRACT;
case Qt::Key_Slash:
return VK_DIVIDE;
case Qt::Key_Tab:
case Qt::Key_Backtab:
return VK_TAB;
case Qt::Key_Backspace:
return VK_BACK;
case Qt::Key_Return:
case Qt::Key_Escape:
return VK_ESCAPE;
case Qt::Key_Enter:
return VK_RETURN;
case Qt::Key_Insert:
return VK_INSERT;
case Qt::Key_Delete:
return VK_DELETE;
case Qt::Key_Pause:
return VK_PAUSE;
case Qt::Key_Print:
return VK_PRINT;
case Qt::Key_Clear:
return VK_CLEAR;
case Qt::Key_Home:
return VK_HOME;
case Qt::Key_End:
return VK_END;
case Qt::Key_Up:
return VK_UP;
case Qt::Key_Down:
return VK_DOWN;
case Qt::Key_Left:
return VK_LEFT;
case Qt::Key_Right:
return VK_RIGHT;
case Qt::Key_PageUp:
return VK_PRIOR;
case Qt::Key_PageDown:
return VK_NEXT;
case Qt::Key_F1:
return VK_F1;
case Qt::Key_F2:
return VK_F2;
case Qt::Key_F3:
return VK_F3;
case Qt::Key_F4:
return VK_F4;
case Qt::Key_F5:
return VK_F5;
case Qt::Key_F6:
return VK_F6;
case Qt::Key_F7:
return VK_F7;
case Qt::Key_F8:
return VK_F8;
case Qt::Key_F9:
return VK_F9;
case Qt::Key_F10:
return VK_F10;
case Qt::Key_F11:
return VK_F11;
case Qt::Key_F12:
return VK_F12;
case Qt::Key_F13:
return VK_F13;
case Qt::Key_F14:
return VK_F14;
case Qt::Key_F15:
return VK_F15;
case Qt::Key_F16:
return VK_F16;
case Qt::Key_F17:
return VK_F17;
case Qt::Key_F18:
return VK_F18;
case Qt::Key_F19:
return VK_F19;
case Qt::Key_F20:
return VK_F20;
case Qt::Key_F21:
return VK_F21;
case Qt::Key_F22:
return VK_F22;
case Qt::Key_F23:
return VK_F23;
case Qt::Key_F24:
return VK_F24;
case Qt::Key_Colon:
case Qt::Key_Semicolon:
return VK_OEM_1;
case Qt::Key_Question:
return VK_OEM_2;
case Qt::Key_AsciiTilde:
case Qt::Key_QuoteLeft:
return VK_OEM_3;
case Qt::Key_BraceLeft:
case Qt::Key_BracketLeft:
return VK_OEM_4;
case Qt::Key_Bar:
case Qt::Key_Backslash:
return VK_OEM_5;
case Qt::Key_BraceRight:
case Qt::Key_BracketRight:
return VK_OEM_6;
case Qt::Key_QuoteDbl:
case Qt::Key_Apostrophe:
return VK_OEM_7;
case Qt::Key_Less:
return VK_OEM_COMMA;
case Qt::Key_Greater:
return VK_OEM_PERIOD;
case Qt::Key_Equal:
return VK_OEM_PLUS;
case Qt::Key_ParenRight:
return 0x30;
case Qt::Key_Exclam:
return 0x31;
case Qt::Key_At:
return 0x32;
case Qt::Key_NumberSign:
return 0x33;
case Qt::Key_Dollar:
return 0x34;
case Qt::Key_Percent:
return 0x35;
case Qt::Key_AsciiCircum:
return 0x36;
case Qt::Key_Ampersand:
return 0x37;
case Qt::Key_copyright:
return 0x38;
case Qt::Key_ParenLeft:
return 0x39;
case Qt::Key_Underscore:
return VK_OEM_MINUS;
case Qt::Key_Meta:
return VK_LWIN;
default:;
}
return key;
}
#endif