mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 23:59:27 +01:00
DolphinQt2: add DoubleClickEventFilter
This is an easy way to get a `doubleClicked` signal for any type of widget without creating custom classes for each one.
This commit is contained in:
parent
47e8cb97b4
commit
20f54fd9ed
@ -40,6 +40,7 @@ set(SRCS
|
||||
GameList/GameListModel.cpp
|
||||
GameList/GameTracker.cpp
|
||||
GameList/ListProxyModel.cpp
|
||||
QtUtils/DoubleClickEventFilter.cpp
|
||||
QtUtils/ElidedButton.cpp
|
||||
Settings/GeneralPane.cpp
|
||||
Settings/InterfacePane.cpp
|
||||
|
@ -52,7 +52,7 @@
|
||||
<AdditionalOptions>/NODEFAULTLIB:libcmt %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\VideoInterface;$(ProjectDir)\GameList;$(ProjectDir)\Settings;$(ProjectDir)\Config;$(ProjectDir)\Config\Mapping;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\VideoInterface;$(ProjectDir)\GameList;$(ProjectDir)\Settings;$(ProjectDir)\Config;$(ProjectDir)\Config\Mapping;$(ProjectDir)\QtUtils;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DolphinQt2.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
@ -88,6 +88,7 @@
|
||||
<QtMoc Include="Settings\InterfacePane.h" />
|
||||
<QtMoc Include="MainWindow.h" />
|
||||
<QtMoc Include="MenuBar.h" />
|
||||
<QtMoc Include="QtUtils\DoubleClickEventFilter.h" />
|
||||
<QtMoc Include="RenderWidget.h" />
|
||||
<QtMoc Include="Settings.h" />
|
||||
<QtMoc Include="Settings\GeneralPane.h" />
|
||||
@ -114,6 +115,7 @@
|
||||
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)PathDialog.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)PropertiesDialog.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)Settings.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
|
||||
@ -146,6 +148,7 @@
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="MainWindow.cpp" />
|
||||
<ClCompile Include="MenuBar.cpp" />
|
||||
<ClCompile Include="QtUtils\DoubleClickEventFilter.cpp" />
|
||||
<ClCompile Include="QtUtils\ElidedButton.cpp" />
|
||||
<ClCompile Include="RenderWidget.cpp" />
|
||||
<ClCompile Include="Resources.cpp" />
|
||||
|
@ -29,6 +29,9 @@
|
||||
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
@ -116,6 +119,9 @@
|
||||
<ClCompile Include="Config\Mapping\WiimoteEmuExtension.cpp" />
|
||||
<ClCompile Include="Config\Mapping\WiimoteEmuGeneral.cpp" />
|
||||
<ClCompile Include="Config\Mapping\WiimoteEmuMotionControl.cpp" />
|
||||
<ClCompile Include="QtUtils\DoubleClickEventFilter.cpp">
|
||||
<Filter>QtUtils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QtUtils\ElidedButton.cpp">
|
||||
<Filter>QtUtils</Filter>
|
||||
</ClCompile>
|
||||
@ -160,6 +166,9 @@
|
||||
</QtMoc>
|
||||
<QtMoc Include="Config\Mapping\MappingWidget.h" />
|
||||
<QtMoc Include="Config\Mapping\MappingWindow.h" />
|
||||
<QtMoc Include="QtUtils\DoubleClickEventFilter.h">
|
||||
<Filter>QtUtils</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUi Include="*.ui" />
|
||||
|
15
Source/Core/DolphinQt2/QtUtils/DoubleClickEventFilter.cpp
Normal file
15
Source/Core/DolphinQt2/QtUtils/DoubleClickEventFilter.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
#include "DolphinQt2/QtUtils/DoubleClickEventFilter.h"
|
||||
|
||||
bool DoubleClickEventFilter::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonDblClick)
|
||||
emit doubleClicked();
|
||||
|
||||
return false;
|
||||
}
|
17
Source/Core/DolphinQt2/QtUtils/DoubleClickEventFilter.h
Normal file
17
Source/Core/DolphinQt2/QtUtils/DoubleClickEventFilter.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class DoubleClickEventFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void doubleClicked();
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user