methodaction: added constructor overload

Dieser Commit ist enthalten in:
Reinder Feenstra 2023-03-30 00:10:39 +02:00
Ursprung 13fa109c17
Commit 811c416ddc
2 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021 Reinder Feenstra
* Copyright (C) 2021,2023 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -31,6 +31,15 @@ MethodAction::MethodAction(Method& method, QObject* parent) :
init();
}
MethodAction::MethodAction(Method& method, std::function<void()> triggered, QObject* parent)
: QAction(parent)
, m_method{method}
, m_forceDisabled{false}
{
init(false);
connect(this, &QAction::triggered, std::move(triggered));
}
MethodAction::MethodAction(const QIcon &icon, Method& method, QObject* parent) :
QAction(icon, QString(), parent),
m_method{method},

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021 Reinder Feenstra
* Copyright (C) 2021,2023 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -46,6 +46,7 @@ class MethodAction : public QAction
public:
MethodAction(Method& method, QObject* parent = nullptr);
MethodAction(Method& method, std::function<void()> triggered, QObject* parent = nullptr);
MethodAction(const QIcon &icon, Method& method, QObject* parent = nullptr);
MethodAction(const QIcon &icon, Method& method, std::function<void()> triggered, QObject* parent = nullptr);