diff --git a/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h b/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h index f793dcc5f..c8bdc465f 100644 --- a/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h @@ -21,6 +21,7 @@ class QLabelWrap : public Napi::ObjectWrap{ Napi::Value setText(const Napi::CallbackInfo& info); Napi::Value text(const Napi::CallbackInfo &info); Napi::Value setPixmap(const Napi::CallbackInfo &info); + Napi::Value setOpenExternalLinks(const Napi::CallbackInfo &info); QWIDGET_WRAPPED_METHODS_DECLARATION diff --git a/src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h b/src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h index d6fa65e9e..efd92d3ca 100644 --- a/src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h @@ -18,6 +18,8 @@ class QScrollAreaWrap : public Napi::ObjectWrap{ //wrapped methods Napi::Value setWidget(const Napi::CallbackInfo &info); Napi::Value takeWidget(const Napi::CallbackInfo &info); + Napi::Value setWidgetResizable(const Napi::CallbackInfo &info); + Napi::Value widgetResizable(const Napi::CallbackInfo &info); QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION }; diff --git a/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp b/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp index 1123fad3c..4e230ce74 100644 --- a/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp @@ -15,6 +15,7 @@ Napi::Object QLabelWrap::init(Napi::Env env, Napi::Object exports) { InstanceMethod("setText", &QLabelWrap::setText), InstanceMethod("text", &QLabelWrap::text), InstanceMethod("setPixmap", &QLabelWrap::setPixmap), + InstanceMethod("setOpenExternalLinks",&QLabelWrap::setOpenExternalLinks), QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QLabelWrap) }); constructor = Napi::Persistent(func); @@ -95,3 +96,11 @@ Napi::Value QLabelWrap::setPixmap(const Napi::CallbackInfo &info) this->instance->setPixmap(*pixmapWrap->getInternalInstance()); return env.Null(); } + +Napi::Value QLabelWrap::setOpenExternalLinks(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + Napi::Boolean open = info[0].As(); + this->instance->setOpenExternalLinks(open.Value()); + return env.Null(); +} \ No newline at end of file diff --git a/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp b/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp index e8c1539d9..d3da0b16a 100644 --- a/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp @@ -9,6 +9,10 @@ Napi::Object QScrollAreaWrap::init(Napi::Env env, Napi::Object exports) { char CLASSNAME[] = "QScrollArea"; Napi::Function func = DefineClass(env, CLASSNAME, { InstanceMethod("setWidget", &QScrollAreaWrap::setWidget), + InstanceMethod("takeWidget", &QScrollAreaWrap::takeWidget), + InstanceMethod("setWidgetResizable", &QScrollAreaWrap::setWidgetResizable), + InstanceMethod("widgetResizable", &QScrollAreaWrap::widgetResizable), + QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(QScrollAreaWrap) }); constructor = Napi::Persistent(func); @@ -54,4 +58,20 @@ Napi::Value QScrollAreaWrap::takeWidget(const Napi::CallbackInfo& info) { this->instance->takeWidget(); // We will not return the value here since we are doing it in js side anyway return env.Null(); -} \ No newline at end of file +} + +Napi::Value QScrollAreaWrap::setWidgetResizable(const Napi::CallbackInfo &info){ + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + Napi::Boolean resizable = info[0].As(); + this->instance->setWidgetResizable(resizable.Value()); + return env.Null(); +} + +Napi::Value QScrollAreaWrap::widgetResizable(const Napi::CallbackInfo &info){ + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + Napi::Boolean resizable = info[0].As(); + bool value = this->instance->widgetResizable(); + return Napi::Value::From(env, value); +} diff --git a/src/demo.ts b/src/demo.ts index 7010395c3..c0b46c480 100644 --- a/src/demo.ts +++ b/src/demo.ts @@ -2,6 +2,7 @@ import { QMainWindow } from "./index"; import { QMenu } from "./lib/QtWidgets/QMenu"; import path from "path"; import { QIcon } from "./lib/QtGui/QIcon"; +import { QLabel } from "./lib/QtWidgets/QLabel"; import { QSystemTrayIcon } from "./lib/QtWidgets/QSystemTrayIcon"; import { QAction } from "./lib/QtWidgets/QAction"; import { QApplication } from "./lib/QtGui/QApplication"; @@ -92,6 +93,11 @@ quitAction.addEventListener("triggered", () => { menu.addAction(quitAction); menu.setTitle("TestMenu"); +const label = new QLabel(); +label.setOpenExternalLinks(true); +label.setText(`Yolo`); +label.show(); +(global as any).label = label; win.setWindowTitle("NodeGUI Demo"); win.resize(400, 700); win.show(); diff --git a/src/lib/QtWidgets/QLabel/index.ts b/src/lib/QtWidgets/QLabel/index.ts index 6ced077dd..ff37f207c 100644 --- a/src/lib/QtWidgets/QLabel/index.ts +++ b/src/lib/QtWidgets/QLabel/index.ts @@ -40,4 +40,7 @@ export class QLabel extends NodeWidget { pixmap() { return this._pixmap; } + setOpenExternalLinks(open: boolean) { + this.native.setOpenExternalLinks(open); + } } diff --git a/src/lib/QtWidgets/QScrollArea/index.ts b/src/lib/QtWidgets/QScrollArea/index.ts index 4917f67a9..2f41778c2 100644 --- a/src/lib/QtWidgets/QScrollArea/index.ts +++ b/src/lib/QtWidgets/QScrollArea/index.ts @@ -39,4 +39,10 @@ export class QScrollArea extends QAbstractScrollArea { } return null; } + setWidgetResizable(resizable: boolean) { + this.native.setWidgetResizable(resizable); + } + widgetResizable(): boolean { + return this.native.widgetResizable(); + } }