Add QWidget.setFixedHeight(), QWidget.setFixedWidth(), and QWidget.sizeHint()

This commit is contained in:
Simon Edwards 2021-12-09 21:51:01 +01:00
parent 47b3d514bb
commit 1ab7d13b96
2 changed files with 24 additions and 4 deletions

View File

@ -493,6 +493,18 @@
} else { \
return env.Null(); \
} \
} \
Napi::Value setFixedHeight(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
int h = info[0].As<Napi::Number>().Int32Value(); \
this->instance->setFixedHeight(h); \
return env.Null(); \
} \
Napi::Value setFixedWidth(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
int w = info[0].As<Napi::Number>().Int32Value(); \
this->instance->setFixedWidth(w); \
return env.Null(); \
}
#endif // QWIDGET_WRAPPED_METHODS_DECLARATION
@ -570,7 +582,9 @@
InstanceMethod("setHidden", &WidgetWrapName::setHidden), \
InstanceMethod("setVisible", &WidgetWrapName::setVisible), \
InstanceMethod("setWindowModified", &WidgetWrapName::setWindowModified), \
InstanceMethod("windowHandle", &WidgetWrapName::windowHandle),
InstanceMethod("windowHandle", &WidgetWrapName::windowHandle), \
InstanceMethod("setFixedHeight", &WidgetWrapName::setFixedHeight), \
InstanceMethod("setFixedWidth", &WidgetWrapName::setFixedWidth),
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE

View File

@ -277,12 +277,16 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
}
}
// TODO: void setEditFocus(bool enable)
// TODO: void setFixedHeight(int h)
setFixedHeight(h: number): void {
this.native.setFixedHeight(h);
}
// TODO: void setFixedSize(const QSize &s)
setFixedSize(width: number, height: number): void {
this.native.setFixedSize(width, height);
}
// TODO: void setFixedWidth(int w)
setFixedWidth(w: number): void {
this.native.setFixedWidth(w);
}
setFocusPolicy(policy: FocusPolicy): void {
this.setProperty('focusPolicy', policy);
}
@ -386,7 +390,9 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
size(): QSize {
return new QSize(this.native.size());
}
// TODO: virtual QSize sizeHint() const
sizeHint(): QSize {
return QSize.fromQVariant(this.property('sizeHint'));
}
// TODO: QSize sizeIncrement() const
// TODO: QSizePolicy sizePolicy() const
// TODO: void stackUnder(QWidget *w)