methodaction: added constructor overload
Dieser Commit ist enthalten in:
Ursprung
13fa109c17
Commit
811c416ddc
@ -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},
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren