mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
Qt: Support versions < 5.6
This commit is contained in:
parent
018ad98714
commit
4fdd4e2718
5 changed files with 102 additions and 70 deletions
22
Source/Core/DolphinQt2/QtUtils/ActionHelper.h
Normal file
22
Source/Core/DolphinQt2/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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue