DolphinQt2: Add missing Q_OBJECT macro to all QObject-related classes missing it

Without this macro, if any signals or slots were attempted to be used,
they wouldn't work; neither would various other features of the Qt
meta-object system. This can also lead to weird behavior in other
circumstances. Qt's documentation specifically states:

"Therefore, we strongly recommend that all subclasses of QObject use the
Q_OBJECT macro regardless of whether or not they actually use signals,
slots, and properties."

on its page for "The Meta-Object System", which can be seen here:
https://doc.qt.io/qt-5/metaobjects.html

Let's opt for "always do the right thing", and keep the code extensible
for the future and not have random things blow up on us.
This commit is contained in:
Lioncash 2018-05-13 16:16:20 -04:00
parent 74d561085c
commit 222fe58e25
23 changed files with 94 additions and 44 deletions

View File

@ -10,6 +10,7 @@
class GraphicsChoice : public QComboBox
{
Q_OBJECT
public:
GraphicsChoice(const QStringList& options, const Config::ConfigInfo<int>& setting);

View File

@ -14,6 +14,7 @@ struct ConfigInfo;
class GraphicsSlider : public QSlider
{
Q_OBJECT
public:
GraphicsSlider(int minimum, int maximum, const Config::ConfigInfo<int>& setting, int tick = 0);
void Update(int value);

View File

@ -15,6 +15,7 @@ class QVBoxLayout;
class GCKeyboardEmu final : public MappingWidget
{
Q_OBJECT
public:
explicit GCKeyboardEmu(MappingWindow* window);

View File

@ -15,6 +15,7 @@ class QVBoxLayout;
class GCMicrophone final : public MappingWidget
{
Q_OBJECT
public:
explicit GCMicrophone(MappingWindow* window);

View File

@ -15,6 +15,7 @@ class QVBoxLayout;
class GCPadEmu final : public MappingWidget
{
Q_OBJECT
public:
explicit GCPadEmu(MappingWindow* window);

View File

@ -13,6 +13,7 @@ class QVBoxLayout;
class GCPadWiiUConfigDialog final : public QDialog
{
Q_OBJECT
public:
explicit GCPadWiiUConfigDialog(int port, QWidget* parent = nullptr);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class Hotkey3D final : public MappingWidget
{
Q_OBJECT
public:
explicit Hotkey3D(MappingWindow* window);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class HotkeyDebugging final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyDebugging(MappingWindow* window);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class HotkeyGeneral final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyGeneral(MappingWindow* window);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class HotkeyGraphics final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyGraphics(MappingWindow* window);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class HotkeyStates final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyStates(MappingWindow* window);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class HotkeyTAS final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyTAS(MappingWindow* window);

View File

@ -10,6 +10,7 @@ class QHBoxLayout;
class HotkeyWii final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyWii(MappingWindow* window);

View File

@ -11,6 +11,7 @@ class QHBoxLayout;
class WiimoteEmuExtension final : public MappingWidget
{
Q_OBJECT
public:
enum class Type
{

View File

@ -7,10 +7,12 @@
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
class QComboBox;
class QHBoxLayout;
class WiimoteEmuExtension;
class WiimoteEmuGeneral final : public MappingWidget
{
Q_OBJECT
public:
explicit WiimoteEmuGeneral(MappingWindow* window, WiimoteEmuExtension* extension);

View File

@ -15,6 +15,7 @@ class QVBoxLayout;
class WiimoteEmuMotionControl final : public MappingWidget
{
Q_OBJECT
public:
explicit WiimoteEmuMotionControl(MappingWindow* window);

View File

@ -65,10 +65,27 @@
<QtMoc Include="Config\FilesystemWidget.h" />
<QtMoc Include="Config\GameConfigWidget.h" />
<QtMoc Include="Config\GeckoCodeWidget.h" />
<QtMoc Include="Config\Mapping\GCKeyboardEmu.h" />
<QtMoc Include="Config\Mapping\GCMicrophone.h" />
<QtMoc Include="Config\Mapping\GCPadEmu.h" />
<QtMoc Include="Config\Mapping\GCPadWiiUConfigDialog.h" />
<QtMoc Include="Config\Mapping\Hotkey3D.h" />
<QtMoc Include="Config\Mapping\HotkeyDebugging.h" />
<QtMoc Include="Config\Mapping\HotkeyGeneral.h" />
<QtMoc Include="Config\Mapping\HotkeyGraphics.h" />
<QtMoc Include="Config\Mapping\HotkeyStates.h" />
<QtMoc Include="Config\Mapping\HotkeyTAS.h" />
<QtMoc Include="Config\Mapping\HotkeyWii.h" />
<QtMoc Include="Config\Mapping\IOWindow.h" />
<QtMoc Include="Config\Mapping\MappingBool.h" />
<QtMoc Include="Config\Mapping\MappingButton.h" />
<QtMoc Include="Config\Mapping\MappingIndicator.h" />
<QtMoc Include="Config\Mapping\MappingNumeric.h" />
<QtMoc Include="Config\Mapping\MappingWidget.h" />
<QtMoc Include="Config\Mapping\MappingWindow.h" />
<QtMoc Include="Config\Mapping\WiimoteEmuExtension.h" />
<QtMoc Include="Config\Mapping\WiimoteEmuGeneral.h" />
<QtMoc Include="Config\Mapping\WiimoteEmuMotionControl.h" />
<QtMoc Include="Config\LogConfigWidget.h" />
<QtMoc Include="Config\LogWidget.h" />
<QtMoc Include="Config\NewPatchDialog.h" />
@ -101,6 +118,7 @@
<QtMoc Include="Debugger\NewBreakpointDialog.h" />
<QtMoc Include="Debugger\RegisterWidget.h" />
<QtMoc Include="Debugger\WatchWidget.h" />
<QtMoc Include="GCMemcardManager.h" />
<QtMoc Include="GameList\GameList.h" />
<QtMoc Include="GameList\GameListModel.h" />
<QtMoc Include="GameList\GameTracker.h" />
@ -108,10 +126,12 @@
<QtMoc Include="GameList\ListProxyModel.h" />
<QtMoc Include="Host.h" />
<QtMoc Include="HotkeyScheduler.h" />
<QtMoc Include="Settings\InterfacePane.h" />
<QtMoc Include="Settings\AudioPane.h" />
<QtMoc Include="Settings\WiiPane.h" />
<QtMoc Include="Settings\GameCubePane.h" />
<QtMoc Include="Settings\InterfacePane.h" />
<QtMoc Include="Settings\PathPane.h" />
<QtMoc Include="Settings\USBDeviceAddToWhitelistDialog.h" />
<QtMoc Include="Settings\WiiPane.h" />
<QtMoc Include="MainWindow.h" />
<QtMoc Include="MenuBar.h" />
<QtMoc Include="NetPlay\GameListDialog.h" />
@ -119,10 +139,12 @@
<QtMoc Include="NetPlay\NetPlayDialog.h" />
<QtMoc Include="NetPlay\NetPlaySetupDialog.h" />
<QtMoc Include="NetPlay\PadMappingDialog.h" />
<QtMoc Include="QtUtils\AspectRatioWidget.h" />
<QtMoc Include="QtUtils\BlockUserInputFilter.h" />
<QtMoc Include="QtUtils\DoubleClickEventFilter.h" />
<QtMoc Include="QtUtils\ElidedButton.h" />
<QtMoc Include="QtUtils\WindowActivationEventFilter.h" />
<QtMoc Include="QtUtils\WrapInScrollArea.h" />
<QtMoc Include="QtUtils\AspectRatioWidget.h" />
<QtMoc Include="RenderWidget.h" />
<QtMoc Include="SearchBar.h" />
<QtMoc Include="Settings.h" />
@ -133,34 +155,39 @@
</ItemGroup>
<!--TODO figure out how to get QtMoc to add outputs to ClCompile's inputs...-->
<ItemGroup>
<ClCompile Include="$(QtMocOutPrefix)CheatCodeEditor.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ARCodeWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AboutDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AdvancedPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AudioPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AdvancedWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AspectRatioWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)AudioPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)BlockUserInputFilter.cpp" />
<ClCompile Include="$(QtMocOutPrefix)BreakpointWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)CheatsManager.cpp" />
<ClCompile Include="$(QtMocOutPrefix)CheatCodeEditor.cpp" />
<ClCompile Include="$(QtMocOutPrefix)CheatWarningWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)CheatsManager.cpp" />
<ClCompile Include="$(QtMocOutPrefix)CodeViewWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)CodeWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ControllersWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ElidedButton.cpp" />
<ClCompile Include="$(QtMocOutPrefix)EnhancementsWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)FIFOPlayerWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCTASInputWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiiTASInputWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)StickWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)IRWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)FilesystemWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WindowActivationEventFilter.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCKeyboardEmu.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCMemcardManager.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCMicrophone.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCPadEmu.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCPadWiiUConfigDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GCTASInputWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameConfigWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameCubePane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameList.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameListDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameListModel.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GameTracker.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GeckoCodeWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GeneralPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiiPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GeneralWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsBool.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsChoice.cpp" />
@ -168,24 +195,35 @@
<ClCompile Include="$(QtMocOutPrefix)GraphicsSlider.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GridProxyModel.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HacksWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Host.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Hotkey3D.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyDebugging.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyGeneral.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyGraphics.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyScheduler.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyStates.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyTAS.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyWii.cpp" />
<ClCompile Include="$(QtMocOutPrefix)IOWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)IRWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)InfoWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)InterfacePane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)IOWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)JITWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GridProxyModel.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ListProxyModel.cpp" />
<ClCompile Include="$(QtMocOutPrefix)LogConfigWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)LogWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MD5Dialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MainWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingBool.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingButton.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingIndicator.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingNumeric.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MappingWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MD5Dialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MemoryWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MemoryViewWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MemoryWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NetPlayDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NetPlaySetupDialog.cpp" />
@ -193,18 +231,25 @@
<ClCompile Include="$(QtMocOutPrefix)NewPatchDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PadMappingDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PatchesWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PathPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)PropertiesDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
<ClCompile Include="$(QtMocOutPrefix)RegisterWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)RenderWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)SearchBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Settings.cpp" />
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)SoftwareRendererWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)StickWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ToolBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WatchWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)USBDeviceAddToWhitelistDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Updater.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WatchWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiiPane.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiiTASInputWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiimoteEmuExtension.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiimoteEmuGeneral.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WiimoteEmuMotionControl.cpp" />
<ClCompile Include="$(QtMocOutPrefix)WindowActivationEventFilter.cpp" />
<ClCompile Include="AboutDialog.cpp" />
<ClCompile Include="CheatsManager.cpp" />
<ClCompile Include="Config\CheatCodeEditor.cpp" />
@ -282,18 +327,18 @@
<ClCompile Include="Main.cpp" />
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="MenuBar.cpp" />
<ClCompile Include="QtUtils\BlockUserInputFilter.cpp" />
<ClCompile Include="NetPlay\GameListDialog.cpp" />
<ClCompile Include="NetPlay\MD5Dialog.cpp" />
<ClCompile Include="NetPlay\NetPlayDialog.cpp" />
<ClCompile Include="NetPlay\NetPlaySetupDialog.cpp" />
<ClCompile Include="NetPlay\PadMappingDialog.cpp" />
<ClCompile Include="QtUtils\AspectRatioWidget.cpp" />
<ClCompile Include="QtUtils\BlockUserInputFilter.cpp" />
<ClCompile Include="QtUtils\DoubleClickEventFilter.cpp" />
<ClCompile Include="QtUtils\ElidedButton.cpp" />
<ClCompile Include="QtUtils\ImageConverter.cpp" />
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" />
<ClCompile Include="QtUtils\AspectRatioWidget.cpp" />
<ClCompile Include="RenderWidget.cpp" />
<ClCompile Include="Resources.cpp" />
<ClCompile Include="SearchBar.cpp" />
@ -313,33 +358,15 @@
</ItemGroup>
<!--Put standard C/C++ headers here. Headers that are listed in the QtMoc ItemGroup must NOT be listed here.-->
<ItemGroup>
<ClInclude Include="Config\Mapping\GCKeyboardEmu.h" />
<ClInclude Include="Config\Mapping\GCMicrophone.h" />
<ClInclude Include="Config\Mapping\GCPadEmu.h" />
<ClInclude Include="Config\Mapping\GCPadWiiU.h" />
<ClInclude Include="Config\Mapping\Hotkey3D.h" />
<ClInclude Include="Config\Mapping\HotkeyGeneral.h" />
<ClInclude Include="Config\Mapping\HotkeyGraphics.h" />
<ClInclude Include="Config\Mapping\HotkeyStates.h" />
<ClInclude Include="Config\Mapping\HotkeyTAS.h" />
<ClInclude Include="QtUtils\WinIconHelper.h" />
<ClInclude Include="TAS\Shared.h" />
<ClInclude Include="Config\Mapping\HotkeyWii.h" />
<ClInclude Include="Config\Mapping\MappingBool.h" />
<ClInclude Include="Config\Mapping\MappingCommon.h" />
<ClInclude Include="Config\Mapping\MappingIndicator.h" />
<ClInclude Include="Config\Mapping\MappingNumeric.h" />
<ClInclude Include="Config\Mapping\WiimoteEmuExtension.h" />
<ClInclude Include="Config\Mapping\WiimoteEmuGeneral.h" />
<ClInclude Include="Config\Mapping\WiimoteEmuMotionControl.h" />
<ClInclude Include="Config\RegisterColumn.h" />
<ClInclude Include="Config\RegisterWidget.h" />
<ClInclude Include="QtUtils\BlockUserInputFilter.h" />
<ClInclude Include="QtUtils\ElidedButton.h" />
<ClInclude Include="Debugger\RegisterColumn.h" />
<ClInclude Include="QtUtils\ActionHelper.h" />
<ClInclude Include="QtUtils\ImageConverter.h" />
<ClInclude Include="QtUtils\QueueOnObject.h" />
<ClInclude Include="QtUtils\RunOnObject.h" />
<ClInclude Include="QtUtils\WinIconHelper.h" />
<ClInclude Include="Resources.h" />
<ClInclude Include="Settings\GameCubePane.h" />
<ClInclude Include="Settings\PathPane.h" />
<ClInclude Include="TAS\Shared.h" />
<ClInclude Include="Translation.h" />
<ClInclude Include="WiiUpdate.h" />
</ItemGroup>

View File

@ -23,6 +23,7 @@ class QTimer;
class GCMemcardManager : public QDialog
{
Q_OBJECT
public:
explicit GCMemcardManager(QWidget* parent = nullptr);
~GCMemcardManager();

View File

@ -10,6 +10,7 @@ class QBoxLayout;
class AspectRatioWidget : public QWidget
{
Q_OBJECT
public:
AspectRatioWidget(QWidget* widget, float width, float height, QWidget* parent = nullptr);
void resizeEvent(QResizeEvent* event);

View File

@ -10,6 +10,7 @@ class QEvent;
class BlockUserInputFilter : public QObject
{
Q_OBJECT
public:
static BlockUserInputFilter* Instance();

View File

@ -8,6 +8,7 @@
class ElidedButton : public QPushButton
{
Q_OBJECT
public:
explicit ElidedButton(const QString& text = QStringLiteral(""),
Qt::TextElideMode elide_mode = Qt::ElideRight);

View File

@ -12,6 +12,7 @@ class QPushButton;
class GameCubePane : public QWidget
{
Q_OBJECT
public:
explicit GameCubePane();

View File

@ -13,6 +13,7 @@ class QListWidget;
class PathPane final : public QWidget
{
Q_OBJECT
public:
explicit PathPane(QWidget* parent = nullptr);