Adds measuremode to leafnode widgets

This commit is contained in:
Atul R
2019-07-11 23:40:25 +02:00
parent 9fbef26cda
commit 275c4b2d64
5 changed files with 13 additions and 2 deletions
@@ -12,7 +12,6 @@ Napi::Object QCheckBoxWrap::init(Napi::Env env, Napi::Object exports) {
Napi::Function func = DefineClass(env, CLASSNAME, {
InstanceMethod("setText", &QCheckBoxWrap::setText),
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QCheckBoxWrap)
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QCheckBoxWrap)
});
constructor = Napi::Persistent(func);
exports.Set(CLASSNAME, func);
@@ -36,6 +35,8 @@ QCheckBoxWrap::QCheckBoxWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<Q
}else {
extrautils::throwTypeError(env, "Wrong number of arguments");
}
// Adds measure function on yoga node so that widget size is calculated based on its text also.
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
}
QCheckBoxWrap::~QCheckBoxWrap() {
@@ -35,6 +35,8 @@ QLineEditWrap::QLineEditWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<Q
}else {
extrautils::throwTypeError(env, "Wrong number of arguments");
}
// Adds measure function on yoga node so that widget size is calculated based on its text also.
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
}
QLineEditWrap::~QLineEditWrap() {
@@ -35,6 +35,8 @@ QProgressBarWrap::QProgressBarWrap(const Napi::CallbackInfo& info): Napi::Object
}else {
extrautils::throwTypeError(env, "Wrong number of arguments");
}
// Adds measure function on yoga node so that widget size is calculated based on its own size.
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
}
QProgressBarWrap::~QProgressBarWrap() {
@@ -35,6 +35,8 @@ QRadioButtonWrap::QRadioButtonWrap(const Napi::CallbackInfo& info): Napi::Object
}else {
extrautils::throwTypeError(env, "Wrong number of arguments");
}
// Adds measure function on yoga node so that widget size is calculated based on its own size.
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
}
QRadioButtonWrap::~QRadioButtonWrap() {