mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Win-Specific: Fix hotkey handling in Qt5
This commit is contained in:
parent
6f2ab430ec
commit
a08102dd42
|
@ -28,6 +28,9 @@ QHotkeyApplication::QHotkeyApplication( QString const & id,
|
|||
int & argc, char ** argv ):
|
||||
QtSingleApplication( id, argc, argv )
|
||||
{
|
||||
#if defined( Q_OS_WIN ) && IS_QT_5
|
||||
installNativeEventFilter( this );
|
||||
#endif
|
||||
}
|
||||
|
||||
void QHotkeyApplication::addDataCommiter( DataCommitter & d )
|
||||
|
|
|
@ -211,11 +211,11 @@ protected:
|
|||
void unregisterWrapper(HotkeyWrapper *wrapper);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
# if IS_QT_5
|
||||
#if IS_QT_5
|
||||
virtual bool nativeEventFilter( const QByteArray & eventType, void * message, long * result );
|
||||
# else // IS_QT_5
|
||||
#else // IS_QT_5
|
||||
virtual bool winEventFilter ( MSG * message, long * result );
|
||||
#endif
|
||||
#endif // IS_QT_5
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
QList<HotkeyWrapper*> hotkeyWrappers;
|
||||
|
|
|
@ -3528,6 +3528,12 @@ void MainWindow::storeResourceSavePath( const QString & newPath )
|
|||
|
||||
#ifdef Q_OS_WIN32
|
||||
|
||||
bool MainWindow::nativeEvent( const QByteArray & eventType, void * message, long * result )
|
||||
{
|
||||
Q_UNUSED( eventType );
|
||||
return winEvent( reinterpret_cast<MSG *>( message ), result );
|
||||
}
|
||||
|
||||
bool MainWindow::winEvent( MSG * message, long * result )
|
||||
{
|
||||
if( message->message != gdAskMessage )
|
||||
|
|
|
@ -403,6 +403,10 @@ signals:
|
|||
/// For receiving message from scan libraries
|
||||
protected:
|
||||
unsigned gdAskMessage;
|
||||
|
||||
// Qt4: winEvent
|
||||
// Qt5: nativeEvent
|
||||
bool nativeEvent( const QByteArray & eventType, void * message, long * result );
|
||||
bool winEvent( MSG * message, long * result );
|
||||
|
||||
private slots:
|
||||
|
|
Loading…
Reference in a new issue