Win-Specific: Fix hotkey handling in Qt5

This commit is contained in:
Timon Wong 2013-06-08 22:36:05 +08:00
parent 6f2ab430ec
commit a08102dd42
4 changed files with 16 additions and 3 deletions

View file

@ -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 )

View file

@ -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;

View file

@ -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 )

View file

@ -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: