mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Qt: Implement hotkeys (+ configuration)
This commit is contained in:
19
Source/Core/DolphinQt2/QtUtils/FocusEventFilter.cpp
Normal file
19
Source/Core/DolphinQt2/QtUtils/FocusEventFilter.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QEvent>
|
||||
#include <QObject>
|
||||
|
||||
#include "DolphinQt2/QtUtils/FocusEventFilter.h"
|
||||
|
||||
bool FocusEventFilter::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::FocusOut)
|
||||
emit focusOutEvent();
|
||||
|
||||
if (event->type() == QEvent::FocusIn)
|
||||
emit focusInEvent();
|
||||
|
||||
return false;
|
||||
}
|
18
Source/Core/DolphinQt2/QtUtils/FocusEventFilter.h
Normal file
18
Source/Core/DolphinQt2/QtUtils/FocusEventFilter.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class FocusEventFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void focusInEvent();
|
||||
void focusOutEvent();
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
};
|
Reference in New Issue
Block a user