mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Move DolphinQt2 to DolphinQt
This commit is contained in:
22
Source/Core/DolphinQt/QtUtils/ActionHelper.h
Normal file
22
Source/Core/DolphinQt/QtUtils/ActionHelper.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QAction>
|
||||
#include <QKeySequence>
|
||||
#include <QString>
|
||||
|
||||
// Since we have to support Qt < 5.6, we need our own implementation of addAction(QString&
|
||||
// text,QObject*,PointerToMemberFunction);
|
||||
template <typename ParentClass, typename RecieverClass, typename Func>
|
||||
QAction* AddAction(ParentClass* parent, const QString& text, const RecieverClass* receiver,
|
||||
Func slot, const QKeySequence& shortcut = 0)
|
||||
{
|
||||
QAction* action = parent->addAction(text);
|
||||
action->setShortcut(shortcut);
|
||||
action->connect(action, &QAction::triggered, receiver, slot);
|
||||
|
||||
return action;
|
||||
}
|
Reference in New Issue
Block a user