Fix repeated menu callback invocation.
This commit is contained in:
parent
4093d6605a
commit
3a6708cdc5
1 changed files with 2 additions and 2 deletions
|
|
@ -19,8 +19,8 @@ not_null<QAction*> CreateAction(
|
||||||
Fn<void()> &&callback) {
|
Fn<void()> &&callback) {
|
||||||
const auto action = new QAction(text, parent);
|
const auto action = new QAction(text, parent);
|
||||||
const auto guard = MakeWeak(parent);
|
const auto guard = MakeWeak(parent);
|
||||||
auto triggered = [guard, callback = std::move(callback)]() mutable {
|
auto triggered = [guard, callback = std::move(callback)] {
|
||||||
InvokeQueued(guard, std::move(callback));
|
InvokeQueued(guard, callback);
|
||||||
};
|
};
|
||||||
parent->connect(action, &QAction::triggered, std::move(triggered));
|
parent->connect(action, &QAction::triggered, std::move(triggered));
|
||||||
return action;
|
return action;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue