removed napi in extra utils
This commit is contained in:
parent
62362c7fe8
commit
fd100b6c54
@ -5,10 +5,6 @@
|
||||
|
||||
void extrautils::noop(){}
|
||||
|
||||
void extrautils::throwTypeError(Napi::Env env, std::string errorMessage){
|
||||
Napi::TypeError::New(env, errorMessage.c_str()).ThrowAsJavaScriptException();
|
||||
}
|
||||
|
||||
YGSize extrautils::measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode){
|
||||
FlexLayout::NodeContext *ctx = FlexLayout::getNodeContext(node);
|
||||
if(ctx){
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <napi.h>
|
||||
#include "src/cpp/core/FlexLayout/flexlayout.h"
|
||||
|
||||
namespace extrautils {
|
||||
void noop();
|
||||
void throwTypeError(Napi::Env env, std::string errorMessage);
|
||||
YGSize measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode);
|
||||
void noop();
|
||||
YGSize measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode);
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ QApplicationWrap::QApplicationWrap(const Napi::CallbackInfo& info)
|
||||
} else if (info.Length() == 0){
|
||||
this->instance = new QApplication(this->argc, this->argv);
|
||||
} else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ QKeyEventWrap::QKeyEventWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<Q
|
||||
Napi::External<QKeyEvent> eventObject = info[0].As<Napi::External<QKeyEvent>>();
|
||||
this->instance = eventObject.Data();
|
||||
} else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ QPixmapWrap::QPixmapWrap(const Napi::CallbackInfo& info) : Napi::ObjectWrap<QPix
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new QPixmap();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ Napi::Value QPixmapWrap::load(const Napi::CallbackInfo& info)
|
||||
QString imageUrl = QString::fromUtf8(url.Utf8Value().c_str());
|
||||
loadSuccess = this->instance->load(imageUrl);
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
return Napi::Boolean::New(env, loadSuccess);
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ QCheckBoxWrap::QCheckBoxWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<Q
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NCheckBox();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
// Adds measure function on yoga node so that widget size is calculated based on its text also.
|
||||
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
|
||||
|
||||
@ -31,7 +31,7 @@ QGridLayoutWrap::QGridLayoutWrap(const Napi::CallbackInfo& info): Napi::ObjectWr
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new QGridLayout();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ QLabelWrap::QLabelWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<QLabelW
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NLabel();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
// Adds measure function on yoga node so that widget size is calculated based on its text also.
|
||||
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
|
||||
|
||||
@ -36,7 +36,7 @@ QLineEditWrap::QLineEditWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<Q
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NLineEdit();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
// Adds measure function on yoga node so that widget size is calculated based on its text also.
|
||||
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
|
||||
|
||||
@ -32,7 +32,7 @@ QMainWindowWrap::QMainWindowWrap(const Napi::CallbackInfo& info): Napi::ObjectWr
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NMainWindow();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
this->instance->setAttribute(Qt::WA_DeleteOnClose);
|
||||
this->instance->installEventFilter(this->instance);
|
||||
|
||||
@ -37,7 +37,7 @@ QProgressBarWrap::QProgressBarWrap(const Napi::CallbackInfo& info): Napi::Object
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NProgressBar();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
// Adds measure function on yoga node so that widget size is calculated based on its own size.
|
||||
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
|
||||
|
||||
@ -31,7 +31,7 @@ QPushButtonWrap::QPushButtonWrap(const Napi::CallbackInfo& info): Napi::ObjectWr
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NPushButton();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
// Adds measure function on yoga node so that widget size is calculated based on its text also.
|
||||
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
|
||||
|
||||
@ -34,7 +34,7 @@ QRadioButtonWrap::QRadioButtonWrap(const Napi::CallbackInfo& info): Napi::Object
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NRadioButton();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
// Adds measure function on yoga node so that widget size is calculated based on its own size.
|
||||
YGNodeSetMeasureFunc(this->instance->getFlexNode(), &extrautils::measureQtWidget);
|
||||
|
||||
@ -29,7 +29,7 @@ QWidgetWrap::QWidgetWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<QWidg
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new NWidget();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ FlexLayoutWrap::FlexLayoutWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap
|
||||
}else if (info.Length() == 0){
|
||||
this->instance = new FlexLayout();
|
||||
}else {
|
||||
extrautils::throwTypeError(env, "Wrong number of arguments");
|
||||
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user