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/GameListModel.cpp
|
||||||
GameList/GameTracker.cpp
|
GameList/GameTracker.cpp
|
||||||
GameList/ListProxyModel.cpp
|
GameList/ListProxyModel.cpp
|
||||||
|
QtUtils/DoubleClickEventFilter.cpp
|
||||||
QtUtils/ElidedButton.cpp
|
QtUtils/ElidedButton.cpp
|
||||||
Settings/GeneralPane.cpp
|
Settings/GeneralPane.cpp
|
||||||
Settings/InterfacePane.cpp
|
Settings/InterfacePane.cpp
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<AdditionalOptions>/NODEFAULTLIB:libcmt %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/NODEFAULTLIB:libcmt %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<ClCompile>
|
<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>
|
</ClCompile>
|
||||||
<Manifest>
|
<Manifest>
|
||||||
<AdditionalManifestFiles>DolphinQt2.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
<AdditionalManifestFiles>DolphinQt2.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
|
@ -88,6 +88,7 @@
|
||||||
<QtMoc Include="Settings\InterfacePane.h" />
|
<QtMoc Include="Settings\InterfacePane.h" />
|
||||||
<QtMoc Include="MainWindow.h" />
|
<QtMoc Include="MainWindow.h" />
|
||||||
<QtMoc Include="MenuBar.h" />
|
<QtMoc Include="MenuBar.h" />
|
||||||
|
<QtMoc Include="QtUtils\DoubleClickEventFilter.h" />
|
||||||
<QtMoc Include="RenderWidget.h" />
|
<QtMoc Include="RenderWidget.h" />
|
||||||
<QtMoc Include="Settings.h" />
|
<QtMoc Include="Settings.h" />
|
||||||
<QtMoc Include="Settings\GeneralPane.h" />
|
<QtMoc Include="Settings\GeneralPane.h" />
|
||||||
|
@ -114,6 +115,7 @@
|
||||||
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)PathDialog.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)PathDialog.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)PropertiesDialog.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)PropertiesDialog.cpp" />
|
||||||
|
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)Settings.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)Settings.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
|
||||||
|
@ -146,6 +148,7 @@
|
||||||
<ClCompile Include="Main.cpp" />
|
<ClCompile Include="Main.cpp" />
|
||||||
<ClCompile Include="MainWindow.cpp" />
|
<ClCompile Include="MainWindow.cpp" />
|
||||||
<ClCompile Include="MenuBar.cpp" />
|
<ClCompile Include="MenuBar.cpp" />
|
||||||
|
<ClCompile Include="QtUtils\DoubleClickEventFilter.cpp" />
|
||||||
<ClCompile Include="QtUtils\ElidedButton.cpp" />
|
<ClCompile Include="QtUtils\ElidedButton.cpp" />
|
||||||
<ClCompile Include="RenderWidget.cpp" />
|
<ClCompile Include="RenderWidget.cpp" />
|
||||||
<ClCompile Include="Resources.cpp" />
|
<ClCompile Include="Resources.cpp" />
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp">
|
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp">
|
||||||
<Filter>Generated Files</Filter>
|
<Filter>Generated Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp">
|
||||||
|
<Filter>Generated Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp">
|
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp">
|
||||||
<Filter>Generated Files</Filter>
|
<Filter>Generated Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -116,6 +119,9 @@
|
||||||
<ClCompile Include="Config\Mapping\WiimoteEmuExtension.cpp" />
|
<ClCompile Include="Config\Mapping\WiimoteEmuExtension.cpp" />
|
||||||
<ClCompile Include="Config\Mapping\WiimoteEmuGeneral.cpp" />
|
<ClCompile Include="Config\Mapping\WiimoteEmuGeneral.cpp" />
|
||||||
<ClCompile Include="Config\Mapping\WiimoteEmuMotionControl.cpp" />
|
<ClCompile Include="Config\Mapping\WiimoteEmuMotionControl.cpp" />
|
||||||
|
<ClCompile Include="QtUtils\DoubleClickEventFilter.cpp">
|
||||||
|
<Filter>QtUtils</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="QtUtils\ElidedButton.cpp">
|
<ClCompile Include="QtUtils\ElidedButton.cpp">
|
||||||
<Filter>QtUtils</Filter>
|
<Filter>QtUtils</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -160,6 +166,9 @@
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="Config\Mapping\MappingWidget.h" />
|
<QtMoc Include="Config\Mapping\MappingWidget.h" />
|
||||||
<QtMoc Include="Config\Mapping\MappingWindow.h" />
|
<QtMoc Include="Config\Mapping\MappingWindow.h" />
|
||||||
|
<QtMoc Include="QtUtils\DoubleClickEventFilter.h">
|
||||||
|
<Filter>QtUtils</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUi Include="*.ui" />
|
<QtUi Include="*.ui" />
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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…
Reference in New Issue