Add QWidget.winId(), useful for forcing window creation

This commit is contained in:
Simon Edwards 2022-02-06 19:09:27 +01:00
parent ed7da32952
commit 2865212937
2 changed files with 10 additions and 2 deletions

View File

@ -533,6 +533,11 @@
int w = info[0].As<Napi::Number>().Int32Value(); \
int result = this->instance->heightForWidth(w); \
return Napi::Number::New(env, result); \
} \
Napi::Value winId(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
int result = this->instance->winId(); \
return Napi::Number::New(env, result); \
}
#endif // QWIDGET_WRAPPED_METHODS_DECLARATION
@ -621,7 +626,8 @@
&WidgetWrapName::unsetLayoutDirection), \
InstanceMethod("unsetLocale", &WidgetWrapName::unsetLocale), \
InstanceMethod("windowRole", &WidgetWrapName::windowRole), \
InstanceMethod("heightForWidth", &WidgetWrapName::heightForWidth),
InstanceMethod("heightForWidth", &WidgetWrapName::heightForWidth), \
InstanceMethod("winId", &WidgetWrapName::winId),
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE

View File

@ -538,7 +538,9 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
width(): number {
return this.property('width').toInt();
}
// TODO: WId winId() const
winId(): number {
return this.native.winId();
}
// TODO: QWidget * window() const
windowFilePath(): string {
return this.property('windowFilePath').toString();