Qwidget wrap fix (#433)
* skip setting up miniqt if customQt is on * adds opengl context * adds NodeWidgetWrap * changed the mode of qode.js to make it executable * 0.15.3
This commit is contained in:
parent
110cb80e82
commit
c742712f6f
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodegui/nodegui",
|
||||
"version": "0.15.2",
|
||||
"version": "0.15.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodegui/nodegui",
|
||||
"version": "0.15.2",
|
||||
"version": "0.15.3",
|
||||
"description": "A cross platform library to build native desktop apps.",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
|
||||
0
scripts/qode.js
Normal file → Executable file
0
scripts/qode.js
Normal file → Executable file
@ -3,12 +3,6 @@
|
||||
const { setupArtifact } = require('@nodegui/artifact-installer');
|
||||
const { miniQt, useCustomQt, qtHome } = require('../config/qtConfig');
|
||||
|
||||
if (!useCustomQt) {
|
||||
console.log(`Minimal Qt ${miniQt.version} setup:`);
|
||||
} else {
|
||||
console.log(`CustomQt detected at ${qtHome} . Hence, skipping Mini Qt installation...`);
|
||||
}
|
||||
|
||||
async function setupQt() {
|
||||
return Promise.all(
|
||||
miniQt.artifacts.map(async artifact =>
|
||||
@ -22,7 +16,13 @@ async function setupQt() {
|
||||
);
|
||||
}
|
||||
|
||||
setupQt().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
if (!useCustomQt) {
|
||||
console.log(`Minimal Qt ${miniQt.version} setup:`);
|
||||
|
||||
setupQt().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
console.log(`CustomQt detected at ${qtHome} . Hence, skipping Mini Qt installation...`);
|
||||
}
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
Napi::Object widgetObject = info[1].As<Napi::Object>(); \
|
||||
QModelIndexWrap* indexWrap = \
|
||||
Napi::ObjectWrap<QModelIndexWrap>::Unwrap(indexObject); \
|
||||
QWidgetWrap* widgetWrap = \
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetObject); \
|
||||
NodeWidgetWrap* widgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject); \
|
||||
this->instance->setIndexWidget(*indexWrap->getInternalInstance(), \
|
||||
widgetWrap->getInternalInstance()); \
|
||||
return env.Null(); \
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
Napi::Object viewPortObject = info[0].As<Napi::Object>(); \
|
||||
QWidgetWrap* viewPortWidgetWrap = \
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(viewPortObject); \
|
||||
NodeWidgetWrap* viewPortWidgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(viewPortObject); \
|
||||
QWidget* viewPort = viewPortWidgetWrap->getInternalInstance(); \
|
||||
this->instance->setViewport(viewPort); \
|
||||
return env.Null(); \
|
||||
|
||||
@ -22,3 +22,19 @@ class DLL_EXPORT QWidgetWrap : public Napi::ObjectWrap<QWidgetWrap> {
|
||||
static Napi::FunctionReference constructor;
|
||||
// wrapped methods
|
||||
};
|
||||
|
||||
// NodeWidgetWrap is exactly like QWidgetWrap but it is used only to unwrap any
|
||||
// N<SomeWidget> to QWidget*
|
||||
class DLL_EXPORT NodeWidgetWrap : public Napi::ObjectWrap<NodeWidgetWrap> {
|
||||
QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
private:
|
||||
QPointer<NWidget> instance;
|
||||
|
||||
public:
|
||||
NodeWidgetWrap(const Napi::CallbackInfo& info)
|
||||
: Napi::ObjectWrap<NodeWidgetWrap>(info){};
|
||||
QWidget* getInternalInstance() { return this->instance; };
|
||||
// class constructor
|
||||
static Napi::FunctionReference constructor;
|
||||
// wrapped methods
|
||||
};
|
||||
|
||||
@ -51,8 +51,8 @@ QActionWrap::QActionWrap(const Napi::CallbackInfo& info)
|
||||
// --- regular cases ---
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NAction(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NAction();
|
||||
|
||||
@ -38,8 +38,8 @@ QBoxLayoutWrap::QBoxLayoutWrap(const Napi::CallbackInfo& info)
|
||||
QBoxLayout::Direction dir = static_cast<QBoxLayout::Direction>(
|
||||
info[0].As<Napi::Number>().Int32Value());
|
||||
Napi::Object parentObject = info[1].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance =
|
||||
new NBoxLayout(dir, parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 1) {
|
||||
@ -92,7 +92,8 @@ Napi::Value QBoxLayoutWrap::addWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
int stretch = info[1].As<Napi::Number>().Int32Value();
|
||||
|
||||
this->instance->addWidget(widget->getInternalInstance(), stretch);
|
||||
@ -105,7 +106,8 @@ Napi::Value QBoxLayoutWrap::insertWidget(const Napi::CallbackInfo& info) {
|
||||
|
||||
int index = info[0].As<Napi::Number>().Int32Value();
|
||||
Napi::Object qwidgetObject = info[1].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
int stretch = info[2].As<Napi::Number>().Int32Value();
|
||||
|
||||
this->instance->insertWidget(index, widget->getInternalInstance(), stretch);
|
||||
@ -134,7 +136,8 @@ Napi::Value QBoxLayoutWrap::removeWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
this->instance->removeWidget(widget->getInternalInstance());
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -39,8 +39,8 @@ QButtonGroupWrap::QButtonGroupWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NButtonGroup(
|
||||
parentWidgetWrap
|
||||
->getInternalInstance()); // this sets the parent to current widget
|
||||
|
||||
@ -46,8 +46,8 @@ QCalendarWidgetWrap::QCalendarWidgetWrap(const Napi::CallbackInfo &info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NCalendarWidget(
|
||||
parentWidgetWrap
|
||||
->getInternalInstance()); // this sets the parent to current widget
|
||||
|
||||
@ -36,8 +36,8 @@ QCheckBoxWrap::QCheckBoxWrap(const Napi::CallbackInfo& info)
|
||||
} else {
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NCheckBox(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NCheckBox();
|
||||
|
||||
@ -49,8 +49,8 @@ QComboBoxWrap::QComboBoxWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
|
||||
this->instance = new NComboBox(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
|
||||
@ -24,8 +24,8 @@ QDateEditWrap::QDateEditWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NDateEdit(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NDateEdit();
|
||||
|
||||
@ -26,8 +26,8 @@ QDateTimeEditWrap::QDateTimeEditWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NDateTimeEdit(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NDateTimeEdit();
|
||||
|
||||
@ -28,8 +28,8 @@ QDialWrap::QDialWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NDial(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NDial();
|
||||
|
||||
@ -37,8 +37,8 @@ QFileDialogWrap::QFileDialogWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 4) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
QWidget* parent = parentWidgetWrap->getInternalInstance();
|
||||
QString caption =
|
||||
QString::fromUtf8(info[1].As<Napi::String>().Utf8Value().c_str());
|
||||
|
||||
@ -25,8 +25,8 @@ QFrameWrap::QFrameWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NFrame(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NFrame();
|
||||
|
||||
@ -28,8 +28,8 @@ QGridLayoutWrap::QGridLayoutWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NGridLayout(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NGridLayout();
|
||||
@ -49,7 +49,8 @@ Napi::Value QGridLayoutWrap::addWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::Number qcol = info[2].As<Napi::Number>();
|
||||
Napi::Number qrowSpan = info[3].As<Napi::Number>();
|
||||
Napi::Number qcolSpan = info[4].As<Napi::Number>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
this->instance->addWidget(widget->getInternalInstance(), qrow, qcol, qrowSpan,
|
||||
qcolSpan);
|
||||
|
||||
@ -61,7 +62,8 @@ Napi::Value QGridLayoutWrap::removeWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
this->instance->removeWidget(widget->getInternalInstance());
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@ QGroupBoxWrap::QGroupBoxWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NGroupBox(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NGroupBox();
|
||||
|
||||
@ -70,8 +70,8 @@ QInputDialogWrap::QInputDialogWrap(const Napi::CallbackInfo& info)
|
||||
Napi::HandleScope scope(env);
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NInputDialog(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NInputDialog();
|
||||
|
||||
@ -41,8 +41,8 @@ QLabelWrap::QLabelWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NLabel(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NLabel();
|
||||
@ -78,7 +78,8 @@ Napi::Value QLabelWrap::setBuddy(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object buddyObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* buddyWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(buddyObject);
|
||||
NodeWidgetWrap* buddyWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(buddyObject);
|
||||
this->instance->setBuddy(buddyWrap->getInternalInstance());
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ QLineEditWrap::QLineEditWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NLineEdit(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NLineEdit();
|
||||
|
||||
@ -53,8 +53,8 @@ QListWidgetWrap::QListWidgetWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NListWidget(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NListWidget();
|
||||
@ -260,7 +260,8 @@ Napi::Value QListWidgetWrap::setItemWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::Object widgetObject = info[1].As<Napi::Object>();
|
||||
QListWidgetItemWrap* itemWrap =
|
||||
Napi::ObjectWrap<QListWidgetItemWrap>::Unwrap(itemObject);
|
||||
QWidgetWrap* widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetObject);
|
||||
NodeWidgetWrap* widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject);
|
||||
this->instance->setItemWidget(itemWrap->getInternalInstance(),
|
||||
widgetWrap->getInternalInstance());
|
||||
return env.Null();
|
||||
|
||||
@ -41,8 +41,8 @@ QMainWindowWrap::QMainWindowWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NMainWindow(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NMainWindow();
|
||||
@ -59,8 +59,8 @@ Napi::Value QMainWindowWrap::setCentralWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object widgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* centralWidget =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetObject);
|
||||
NodeWidgetWrap* centralWidget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject);
|
||||
this->instance->setCentralWidget(centralWidget->getInternalInstance());
|
||||
return env.Null();
|
||||
}
|
||||
@ -90,7 +90,8 @@ Napi::Value QMainWindowWrap::setMenuWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object menuObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* menuWidget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(menuObject);
|
||||
NodeWidgetWrap* menuWidget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(menuObject);
|
||||
|
||||
this->instance->setMenuWidget(menuWidget->getInternalInstance());
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ QMenuWrap::QMenuWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NMenu(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NMenu();
|
||||
|
||||
@ -37,8 +37,8 @@ QMenuBarWrap::QMenuBarWrap(const Napi::CallbackInfo& info)
|
||||
new NMenuBar(info[0].As<Napi::External<NMenuBar>>().Data());
|
||||
} else {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NMenuBar(parentWidgetWrap->getInternalInstance());
|
||||
}
|
||||
} else if (info.Length() == 0) {
|
||||
|
||||
@ -35,8 +35,8 @@ QMessageBoxWrap::QMessageBoxWrap(const Napi::CallbackInfo& info)
|
||||
Napi::HandleScope scope(env);
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NMessageBox(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NMessageBox();
|
||||
@ -91,8 +91,8 @@ Napi::Value StaticQMessageBoxWrapMethods::about(
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
Napi::String napiTitle = info[1].As<Napi::String>();
|
||||
std::string title = napiTitle.Utf8Value();
|
||||
Napi::String napiText = info[2].As<Napi::String>();
|
||||
@ -110,8 +110,8 @@ Napi::Value StaticQMessageBoxWrapMethods::aboutQt(
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
Napi::String napiTitle = info[1].As<Napi::String>();
|
||||
std::string title = napiTitle.Utf8Value();
|
||||
QMessageBox::aboutQt(parentWidgetWrap->getInternalInstance(),
|
||||
|
||||
@ -42,8 +42,8 @@ QPainterWrap::QPainterWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object deviceObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* deviceWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(deviceObject);
|
||||
NodeWidgetWrap* deviceWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(deviceObject);
|
||||
this->instance = new QPainter(deviceWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new QPainter();
|
||||
@ -68,7 +68,8 @@ Napi::Value QPainterWrap::begin(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object deviceObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* deviceWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(deviceObject);
|
||||
NodeWidgetWrap* deviceWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(deviceObject);
|
||||
QWidget* device = deviceWrap->getInternalInstance();
|
||||
bool ret = this->instance->begin(device);
|
||||
return Napi::Value::From(env, ret);
|
||||
|
||||
@ -41,8 +41,8 @@ QPlainTextEditWrap::QPlainTextEditWrap(const Napi::CallbackInfo &info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance =
|
||||
new NPlainTextEdit(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
|
||||
@ -34,8 +34,8 @@ QProgressBarWrap::QProgressBarWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NProgressBar(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NProgressBar();
|
||||
|
||||
@ -40,8 +40,8 @@ QPushButtonWrap::QPushButtonWrap(const Napi::CallbackInfo& info)
|
||||
} else {
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NPushButton(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NPushButton();
|
||||
|
||||
@ -34,8 +34,8 @@ QRadioButtonWrap::QRadioButtonWrap(const Napi::CallbackInfo& info)
|
||||
} else {
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance =
|
||||
new NRadioButton(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
|
||||
@ -32,8 +32,8 @@ QScrollAreaWrap::QScrollAreaWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NScrollArea(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NScrollArea();
|
||||
@ -69,8 +69,8 @@ Napi::Value QScrollAreaWrap::ensureWidgetVisible(
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object childWidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* childWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(childWidgetObject);
|
||||
NodeWidgetWrap* childWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(childWidgetObject);
|
||||
int xmargin = info[1].As<Napi::Number>().Int32Value();
|
||||
int ymargin = info[2].As<Napi::Number>().Int32Value();
|
||||
this->instance->ensureWidgetVisible(childWidgetWrap->getInternalInstance(),
|
||||
@ -83,8 +83,8 @@ Napi::Value QScrollAreaWrap::setWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object contentWidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* contentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(contentWidgetObject);
|
||||
NodeWidgetWrap* contentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(contentWidgetObject);
|
||||
this->instance->setWidget(contentWidgetWrap->getInternalInstance());
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ QScrollBarWrap::QScrollBarWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NScrollBar(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NScrollBar();
|
||||
|
||||
@ -33,8 +33,8 @@ QShortcutWrap::QShortcutWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NShortcut(parentWidgetWrap->getInternalInstance());
|
||||
} else {
|
||||
Napi::TypeError::New(env, "Wrong number of arguments")
|
||||
|
||||
@ -27,8 +27,8 @@ QSliderWrap::QSliderWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NSlider(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NSlider();
|
||||
|
||||
@ -27,8 +27,8 @@ QSpinBoxWrap::QSpinBoxWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NSpinBox(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NSpinBox();
|
||||
|
||||
@ -39,8 +39,8 @@ QStackedWidgetWrap::QStackedWidgetWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NStackedWidget(
|
||||
parentWidgetWrap
|
||||
->getInternalInstance()); // this sets the parent to current widget
|
||||
@ -60,7 +60,8 @@ Napi::Value QStackedWidgetWrap::addWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
this->instance->addWidget(widget->getInternalInstance());
|
||||
|
||||
return env.Null();
|
||||
@ -71,7 +72,8 @@ Napi::Value QStackedWidgetWrap::removeWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
this->instance->removeWidget(widget->getInternalInstance());
|
||||
return env.Null();
|
||||
}
|
||||
@ -98,7 +100,8 @@ Napi::Value QStackedWidgetWrap::setCurrentWidget(
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
|
||||
this->instance->setCurrentWidget(widget->getInternalInstance());
|
||||
return env.Null();
|
||||
|
||||
@ -54,8 +54,8 @@ QStatusBarWrap::QStatusBarWrap(const Napi::CallbackInfo &info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
|
||||
this->instance = new NStatusBar(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
@ -77,7 +77,8 @@ Napi::Value QStatusBarWrap::addPermanentWidget(const Napi::CallbackInfo &info) {
|
||||
Napi::Object widgetArg = info[0].As<Napi::Object>();
|
||||
Napi::Number stretchArg = info[1].As<Napi::Number>();
|
||||
|
||||
QWidgetWrap *widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetArg);
|
||||
NodeWidgetWrap *widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetArg);
|
||||
QWidget *widget = widgetWrap->getInternalInstance();
|
||||
int stretch = stretchArg.Int32Value();
|
||||
|
||||
@ -93,7 +94,8 @@ Napi::Value QStatusBarWrap::addWidget(const Napi::CallbackInfo &info) {
|
||||
Napi::Object widgetArg = info[0].As<Napi::Object>();
|
||||
Napi::Number stretchArg = info[1].As<Napi::Number>();
|
||||
|
||||
QWidgetWrap *widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetArg);
|
||||
NodeWidgetWrap *widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetArg);
|
||||
QWidget *widget = widgetWrap->getInternalInstance();
|
||||
int stretch = stretchArg.Int32Value();
|
||||
|
||||
@ -130,7 +132,8 @@ Napi::Value QStatusBarWrap::insertPermanentWidget(
|
||||
Napi::Number stretchArg = info[2].As<Napi::Number>();
|
||||
|
||||
int index = indexArg.Int32Value();
|
||||
QWidgetWrap *widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetArg);
|
||||
NodeWidgetWrap *widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetArg);
|
||||
QWidget *widget = widgetWrap->getInternalInstance();
|
||||
int stretch = stretchArg.Int32Value();
|
||||
|
||||
@ -149,7 +152,8 @@ Napi::Value QStatusBarWrap::insertWidget(const Napi::CallbackInfo &info) {
|
||||
Napi::Number stretchArg = info[2].As<Napi::Number>();
|
||||
|
||||
int index = indexArg.Int32Value();
|
||||
QWidgetWrap *widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetArg);
|
||||
NodeWidgetWrap *widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetArg);
|
||||
QWidget *widget = widgetWrap->getInternalInstance();
|
||||
int stretch = stretchArg.Int32Value();
|
||||
|
||||
@ -173,7 +177,8 @@ Napi::Value QStatusBarWrap::removeWidget(const Napi::CallbackInfo &info) {
|
||||
|
||||
Napi::Object widgetArg = info[0].As<Napi::Object>();
|
||||
|
||||
QWidgetWrap *widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetArg);
|
||||
NodeWidgetWrap *widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetArg);
|
||||
QWidget *widget = widgetWrap->getInternalInstance();
|
||||
|
||||
this->instance->removeWidget(widget);
|
||||
|
||||
@ -39,8 +39,8 @@ QSystemTrayIconWrap::QSystemTrayIconWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NSystemTrayIcon(
|
||||
parentWidgetWrap
|
||||
->getInternalInstance()); // this sets the parent to current widget
|
||||
|
||||
@ -39,8 +39,8 @@ QTabWidgetWrap::QTabWidgetWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NTabWidget(
|
||||
parentWidgetWrap
|
||||
->getInternalInstance()); // this sets the parent to current widget
|
||||
@ -64,8 +64,8 @@ Napi::Value QTabWidgetWrap::addTab(const Napi::CallbackInfo& info) {
|
||||
Napi::String napiLabel = info[2].As<Napi::String>();
|
||||
std::string label = napiLabel.Utf8Value();
|
||||
|
||||
QWidgetWrap* pageObjectWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(pageObject);
|
||||
NodeWidgetWrap* pageObjectWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(pageObject);
|
||||
QIconWrap* iconWrap = Napi::ObjectWrap<QIconWrap>::Unwrap(iconObject);
|
||||
|
||||
int index =
|
||||
@ -80,8 +80,8 @@ Napi::Value QTabWidgetWrap::indexOf(const Napi::CallbackInfo& info) {
|
||||
|
||||
Napi::Object widgetObject = info[0].As<Napi::Object>();
|
||||
|
||||
QWidgetWrap* widgetObjectWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetObject);
|
||||
NodeWidgetWrap* widgetObjectWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject);
|
||||
|
||||
int index = this->instance->indexOf(widgetObjectWrap->getInternalInstance());
|
||||
return Napi::Number::New(env, index);
|
||||
|
||||
@ -38,8 +38,8 @@ QTableViewWrap::QTableViewWrap(const Napi::CallbackInfo& info)
|
||||
// --- regular cases ---
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NTableView(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NTableView();
|
||||
|
||||
@ -78,8 +78,8 @@ QTableWidgetWrap::QTableWidgetWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 3) {
|
||||
Napi::Object parentObject = info[2].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NTableWidget(
|
||||
rows, columns, parentWidgetWrap->getInternalInstance());
|
||||
} else {
|
||||
@ -88,8 +88,8 @@ QTableWidgetWrap::QTableWidgetWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
} else if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NTableWidget(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NTableWidget();
|
||||
@ -159,7 +159,8 @@ Napi::Value QTableWidgetWrap::setCellWidget(const Napi::CallbackInfo& info) {
|
||||
int row = info[0].As<Napi::Number>().Int32Value();
|
||||
int column = info[1].As<Napi::Number>().Int32Value();
|
||||
Napi::Object widgetObject = info[2].As<Napi::Object>();
|
||||
QWidgetWrap* widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetObject);
|
||||
NodeWidgetWrap* widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject);
|
||||
|
||||
this->instance->setCellWidget(row, column, widgetWrap->getInternalInstance());
|
||||
return env.Null();
|
||||
|
||||
@ -24,8 +24,8 @@ QTimeEditWrap::QTimeEditWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NTimeEdit(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NTimeEdit();
|
||||
|
||||
@ -43,8 +43,8 @@ QToolButtonWrap::QToolButtonWrap(const Napi::CallbackInfo& info)
|
||||
} else {
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NToolButton(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NToolButton();
|
||||
|
||||
@ -35,8 +35,8 @@ QTreeWidgetWrap::QTreeWidgetWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NTreeWidget(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new NTreeWidget();
|
||||
@ -138,7 +138,8 @@ Napi::Value QTreeWidgetWrap::setItemWidget(const Napi::CallbackInfo& info) {
|
||||
int column = info[1].As<Napi::Number>().Int32Value();
|
||||
|
||||
Napi::Object widgetObject = info[2].As<Napi::Object>();
|
||||
QWidgetWrap* widgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(widgetObject);
|
||||
NodeWidgetWrap* widgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject);
|
||||
QWidget* widget = widgetWrap->getInternalInstance();
|
||||
|
||||
this->instance->setItemWidget(item, column, widget);
|
||||
|
||||
@ -29,8 +29,8 @@ QWidgetWrap::QWidgetWrap(const Napi::CallbackInfo &info)
|
||||
new NWidget(info[0].As<Napi::External<NWidget>>().Data());
|
||||
} else {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap *parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NWidget(parentWidgetWrap->getInternalInstance());
|
||||
}
|
||||
} else if (info.Length() == 0) {
|
||||
|
||||
@ -32,8 +32,8 @@ FlexLayoutWrap::FlexLayoutWrap(const Napi::CallbackInfo& info)
|
||||
|
||||
if (info.Length() == 1) {
|
||||
Napi::Object parentObject = info[0].As<Napi::Object>();
|
||||
QWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new FlexLayout(parentWidgetWrap->getInternalInstance());
|
||||
} else if (info.Length() == 0) {
|
||||
this->instance = new FlexLayout();
|
||||
@ -51,7 +51,8 @@ Napi::Value FlexLayoutWrap::addWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
Napi::External<YGNode> childFlexNodeObject =
|
||||
info[1].As<Napi::External<YGNode>>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
YGNodeRef childNodeRef = childFlexNodeObject.Data();
|
||||
this->instance->addWidget(widget->getInternalInstance(), childNodeRef);
|
||||
|
||||
@ -67,7 +68,8 @@ Napi::Value FlexLayoutWrap::insertChildBefore(const Napi::CallbackInfo& info) {
|
||||
info[1].As<Napi::External<YGNode>>();
|
||||
Napi::External<YGNode> childFlexNodeObject =
|
||||
info[2].As<Napi::External<YGNode>>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
YGNodeRef childNodeRef = childFlexNodeObject.Data();
|
||||
YGNodeRef beforeChildNodeRef = beforeChildFlexNodeObject.Data();
|
||||
|
||||
@ -84,7 +86,8 @@ Napi::Value FlexLayoutWrap::removeWidget(const Napi::CallbackInfo& info) {
|
||||
Napi::Object qwidgetObject = info[0].As<Napi::Object>();
|
||||
Napi::External<YGNode> childFlexNodeObject =
|
||||
info[1].As<Napi::External<YGNode>>();
|
||||
QWidgetWrap* widget = Napi::ObjectWrap<QWidgetWrap>::Unwrap(qwidgetObject);
|
||||
NodeWidgetWrap* widget =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(qwidgetObject);
|
||||
YGNodeRef childNodeRef = childFlexNodeObject.Data();
|
||||
this->instance->removeWidget(widget->getInternalInstance(), childNodeRef);
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ int QtRunLoopWrapper() {
|
||||
|
||||
void integrate() {
|
||||
// Bootstrap Qt
|
||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
app = new NApplication(qode::qode_argc, qode::qode_argv);
|
||||
qode::InjectCustomRunLoop(&QtRunLoopWrapper);
|
||||
// Other init settings
|
||||
|
||||
Loading…
Reference in New Issue
Block a user