diff --git a/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp b/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp index 5da28f3a1..2b277e6da 100644 --- a/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp +++ b/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp @@ -34,6 +34,7 @@ QMainWindowWrap::QMainWindowWrap(const Napi::CallbackInfo& info): Napi::ObjectWr }else { extrautils::throwTypeError(env, "Wrong number of arguments"); } + this->instance->setAttribute(Qt::WA_DeleteOnClose); } QMainWindowWrap::~QMainWindowWrap() { diff --git a/src/cpp/QtWidgets/QPushButton/npushbutton.h b/src/cpp/QtWidgets/QPushButton/npushbutton.h index 0610af21d..1bbedc13e 100644 --- a/src/cpp/QtWidgets/QPushButton/npushbutton.h +++ b/src/cpp/QtWidgets/QPushButton/npushbutton.h @@ -15,14 +15,11 @@ public: SET_YOGA_WIDGET_Q_PROPERTIES using QPushButton::QPushButton; //inherit all constructors of QPushButton NPushButton(){ - connect(this, SIGNAL(pressed()),this,SLOT( - handleButton() - )); + connect(this, SIGNAL(pressed()),this,SLOT(handleButton())); } - ~NPushButton(){ - spdlog::info("DESTRUCTOR CALLED NPUSHBUTTON"); + ~NPushButton() { this->emitRef.reset(); - } + }; Q_OBJECT private slots: void handleButton(){ @@ -32,8 +29,6 @@ private slots: // arguments for the call args = { Napi::String::New(env, "clicked"), Napi::String::New(env, "YOLO") }; }); - spdlog::info("HANDLEBUTTON CALLED NPUSHBUTTON"); - } public: void setNodeEmitterEmit( std::unique_ptr &emitterEmit){ diff --git a/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp b/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp index f0707bc63..132369f05 100644 --- a/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp +++ b/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp @@ -37,11 +37,9 @@ QPushButtonWrap::QPushButtonWrap(const Napi::CallbackInfo& info): Napi::ObjectWr } QPushButtonWrap::~QPushButtonWrap() { - spdlog::info("WRAPPER DESTRUCTOR CALLED"); delete this->instance; } - Napi::Value QPushButtonWrap::setText(const Napi::CallbackInfo& info) { Napi::Env env = info.Env(); Napi::HandleScope scope(env); @@ -49,8 +47,6 @@ Napi::Value QPushButtonWrap::setText(const Napi::CallbackInfo& info) { Napi::String napiText = info[0].As(); std::string text = napiText.Utf8Value(); this->instance->setText(text.c_str()); - // this->instance->repaint(); - return env.Null(); }