diff --git a/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h index 99dd5c81e..13bd0f449 100644 --- a/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h @@ -533,6 +533,11 @@ int w = info[0].As().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 diff --git a/src/lib/QtWidgets/QWidget.ts b/src/lib/QtWidgets/QWidget.ts index 89398cb49..2a8fb1055 100644 --- a/src/lib/QtWidgets/QWidget.ts +++ b/src/lib/QtWidgets/QWidget.ts @@ -538,7 +538,9 @@ export abstract class NodeWidget 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();