Adds size methods to qmainwindow and setText accepts number
This commit is contained in:
parent
5fccc207f7
commit
ac0a544565
@ -11,6 +11,7 @@ Napi::Object QMainWindowWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QMainWindowWrap)
|
||||
YOGAWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QMainWindowWrap)
|
||||
InstanceMethod("setCentralWidget",&QMainWindowWrap::setCentralWidget),
|
||||
InstanceMethod("setFixedSize",&QMainWindowWrap::setFixedSize),
|
||||
});
|
||||
constructor = Napi::Persistent(func);
|
||||
exports.Set(CLASSNAME, func);
|
||||
@ -53,5 +54,13 @@ Napi::Value QMainWindowWrap::setCentralWidget(const Napi::CallbackInfo& info){
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QMainWindowWrap::setFixedSize(const Napi::CallbackInfo& info){
|
||||
Napi::Env env = info.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
int width = info[0].As<Napi::Number>().Int32Value();
|
||||
int height = info[1].As<Napi::Number>().Int32Value();
|
||||
this->instance->setFixedSize(width, height);
|
||||
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ public:
|
||||
static Napi::FunctionReference constructor;
|
||||
//wrapped methods
|
||||
Napi::Value setCentralWidget(const Napi::CallbackInfo& info);
|
||||
Napi::Value setFixedSize(const Napi::CallbackInfo& info);
|
||||
|
||||
QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
YOGAWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
|
||||
@ -16,8 +16,8 @@ export class QLabel extends NodeWidget {
|
||||
setWordWrap(on: boolean) {
|
||||
this.native.setWordWrap(on);
|
||||
}
|
||||
setText(text: string) {
|
||||
this.native.setText(text);
|
||||
setText(text: string | number) {
|
||||
this.native.setText(`${text}`);
|
||||
}
|
||||
text() {
|
||||
return this.native.text();
|
||||
|
||||
@ -15,4 +15,7 @@ export class QMainWindow extends NodeWidget {
|
||||
this.native.setCentralWidget(widget.native);
|
||||
this.children.add(widget);
|
||||
}
|
||||
setFixedSize(width: number, height: number) {
|
||||
this.native.setFixedSize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ export class QPushButton extends SignalNodeWidget {
|
||||
this.native = native;
|
||||
}
|
||||
|
||||
setText(text: string) {
|
||||
this.native.setText(text);
|
||||
setText(text: string | number) {
|
||||
this.native.setText(`${text}`);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user