Fixes non destructing widgets on close
This commit is contained in:
parent
f5b962f65b
commit
092e44fbb6
@ -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() {
|
||||
|
||||
@ -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<ThreadSafeCallback> &emitterEmit){
|
||||
|
||||
@ -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<Napi::String>();
|
||||
std::string text = napiText.Utf8Value();
|
||||
this->instance->setText(text.c_str());
|
||||
// this->instance->repaint();
|
||||
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user