added support for QWidget::removeAction #548 (#549)

This commit is contained in:
Mihkel 2020-05-08 09:40:00 +03:00 committed by GitHub
parent 2ab8484794
commit 17239ae5cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -378,6 +378,15 @@
this->instance->addAction(actionWrap->getInternalInstance()); \
return env.Null(); \
} \
Napi::Value removeAction(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
Napi::HandleScope scope(env); \
Napi::Object actionObject = info[0].As<Napi::Object>(); \
QActionWrap* actionWrap = \
Napi::ObjectWrap<QActionWrap>::Unwrap(actionObject); \
this->instance->removeAction(actionWrap->getInternalInstance()); \
return env.Null(); \
} \
Napi::Value repolish(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
Napi::HandleScope scope(env); \
@ -450,6 +459,7 @@
InstanceMethod("showMinimized", &WidgetWrapName::showMinimized), \
InstanceMethod("showNormal", &WidgetWrapName::showNormal), \
InstanceMethod("addAction", &WidgetWrapName::addAction), \
InstanceMethod("removeAction", &WidgetWrapName::removeAction), \
InstanceMethod("repolish", &WidgetWrapName::repolish), \
InstanceMethod("setGraphicsEffect", &WidgetWrapName::setGraphicsEffect),

View File

@ -253,6 +253,10 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
this.native.addAction(action.native);
this.actions.add(action);
return action;
}
removeAction(action: QAction): void {
this.native.removeAction(action.native);
this.actions.delete(action);
}
repolish(): void {
this.native.repolish();