diff --git a/CMakeLists.txt b/CMakeLists.txt index f939e8348..a3cfb3b8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ add_library(${CORE_WIDGETS_ADDON} SHARED "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QDateEdit/qdateedit_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QDateTimeEdit/qdatetimeedit_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QFileDialog/qfiledialog_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QFrame/qframe_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QListWidget/qlistwidget_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QListWidgetItem/qlistwidgetitem_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QTableView/qtableview_wrap.cpp" @@ -120,6 +121,7 @@ add_library(${CORE_WIDGETS_ADDON} SHARED "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QDateTimeEdit/ndatetimeedit.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QDial/ndial.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QFileDialog/nfiledialog.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QFrame/nframe.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QListWidget/nlistwidget.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QTableView/ntableview.hpp" "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QTableWidget/ntablewidget.hpp" diff --git a/src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h b/src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h index 1aff7a049..7768a1a29 100644 --- a/src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h @@ -1,6 +1,6 @@ - #pragma once -#include "QtWidgets/QWidget/qwidget_macro.h" + +#include "QtWidgets/QFrame/qframe_macro.h" #include "QtWidgets/QWidget/qwidget_wrap.h" /* @@ -12,7 +12,9 @@ #ifndef QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION #define QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION \ - QWIDGET_WRAPPED_METHODS_DECLARATION \ + \ + QFRAME_WRAPPED_METHODS_DECLARATION \ + \ Napi::Value setViewport(const Napi::CallbackInfo& info) { \ Napi::Env env = info.Env(); \ Napi::HandleScope scope(env); \ @@ -38,13 +40,15 @@ #ifndef QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE #define QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \ - QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \ + \ + QFRAME_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \ + \ InstanceMethod("setViewport", &WidgetWrapName::setViewport), \ InstanceMethod("viewport", &WidgetWrapName::viewport), #endif // QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE #ifndef QABSTRACTSCROLLAREA_SIGNALS -#define QABSTRACTSCROLLAREA_SIGNALS QWIDGET_SIGNALS +#define QABSTRACTSCROLLAREA_SIGNALS QFRAME_SIGNALS #endif diff --git a/src/cpp/include/nodegui/QtWidgets/QFrame/nframe.hpp b/src/cpp/include/nodegui/QtWidgets/QFrame/nframe.hpp new file mode 100644 index 000000000..71c1a65cb --- /dev/null +++ b/src/cpp/include/nodegui/QtWidgets/QFrame/nframe.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +#include "Extras/Utils/nutils.h" +#include "QtWidgets/QFrame/qframe_macro.h" +#include "core/NodeWidget/nodewidget.h" + +class DLL_EXPORT NFrame : public QFrame, public NodeWidget { + Q_OBJECT + NODEWIDGET_IMPLEMENTATIONS(QFrame) + public: + using QFrame::QFrame; + + void connectSignalsToEventEmitter() { QFRAME_SIGNALS } +}; diff --git a/src/cpp/include/nodegui/QtWidgets/QFrame/qframe_macro.h b/src/cpp/include/nodegui/QtWidgets/QFrame/qframe_macro.h new file mode 100644 index 000000000..be2d7cfd3 --- /dev/null +++ b/src/cpp/include/nodegui/QtWidgets/QFrame/qframe_macro.h @@ -0,0 +1,46 @@ +#pragma once + +#include "QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" + +/* + + This macro adds common QFrame exported methods + The exported methods are taken into this macro to avoid writing them in each + and every widget we export. + */ + +#ifndef QFRAME_WRAPPED_METHODS_DECLARATION +#define QFRAME_WRAPPED_METHODS_DECLARATION \ + \ + QWIDGET_WRAPPED_METHODS_DECLARATION \ + \ + Napi::Value frameStyle(const Napi::CallbackInfo& info) { \ + Napi::Env env = info.Env(); \ + Napi::HandleScope scope(env); \ + return Napi::Number::New(env, this->instance->frameStyle()); \ + } \ + Napi::Value setFrameStyle(const Napi::CallbackInfo& info) { \ + Napi::Env env = info.Env(); \ + Napi::HandleScope scope(env); \ + int style = info[0].As().Int32Value(); \ + this->instance->setFrameStyle(style); \ + return env.Null(); \ + } + +#endif // QFRAME_WRAPPED_METHODS_DECLARATION + +#ifndef QFRAME_WRAPPED_METHODS_EXPORT_DEFINE +#define QFRAME_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \ + \ + QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \ + \ + InstanceMethod("frameStyle", &WidgetWrapName::frameStyle), \ + InstanceMethod("setFrameStyle", &WidgetWrapName::setFrameStyle), + +#endif // QFRAME_WRAPPED_METHODS_EXPORT_DEFINE + +#ifndef QFRAME_SIGNALS +#define QFRAME_SIGNALS QWIDGET_SIGNALS + +#endif // QFRAME_SIGNALS diff --git a/src/cpp/include/nodegui/QtWidgets/QFrame/qframe_wrap.h b/src/cpp/include/nodegui/QtWidgets/QFrame/qframe_wrap.h new file mode 100644 index 000000000..cdf8a05ae --- /dev/null +++ b/src/cpp/include/nodegui/QtWidgets/QFrame/qframe_wrap.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +#include "Extras/Utils/nutils.h" +#include "QtWidgets/QFrame/nframe.hpp" +#include "QtWidgets/QFrame/qframe_macro.h" + +class DLL_EXPORT QFrameWrap : public Napi::ObjectWrap { + QFRAME_WRAPPED_METHODS_DECLARATION + private: + QPointer instance; + + public: + static Napi::Object init(Napi::Env env, Napi::Object exports); + QFrameWrap(const Napi::CallbackInfo& info); + ~QFrameWrap(); + NFrame* getInternalInstance(); + // class constructor + static Napi::FunctionReference constructor; + // wrapped methods +}; diff --git a/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp b/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp index cd1524162..9fa0029b2 100644 --- a/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp @@ -3,7 +3,7 @@ #include #include "Extras/Utils/nutils.h" -#include "QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QFrame/qframe_macro.h" #include "core/NodeWidget/nodewidget.h" class DLL_EXPORT NLabel : public QLabel, public NodeWidget { @@ -13,7 +13,7 @@ class DLL_EXPORT NLabel : public QLabel, public NodeWidget { using QLabel::QLabel; // inherit all constructors of QLabel void connectSignalsToEventEmitter() { - QWIDGET_SIGNALS + QFRAME_SIGNALS QObject::connect(this, &QLabel::linkActivated, [=](const QString& link) { Napi::Env env = this->emitOnNode.Env(); Napi::HandleScope scope(env); diff --git a/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h b/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h index 0c9f17249..ce8a3f1c9 100644 --- a/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h @@ -5,11 +5,11 @@ #include #include "Extras/Utils/nutils.h" -#include "QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QFrame/qframe_macro.h" #include "nlabel.hpp" class DLL_EXPORT QLabelWrap : public Napi::ObjectWrap { - QWIDGET_WRAPPED_METHODS_DECLARATION + QFRAME_WRAPPED_METHODS_DECLARATION private: QPointer instance; diff --git a/src/cpp/include/nodegui/QtWidgets/QStackedWidget/nstackedwidget.hpp b/src/cpp/include/nodegui/QtWidgets/QStackedWidget/nstackedwidget.hpp index 165c15e0f..c05629e4e 100644 --- a/src/cpp/include/nodegui/QtWidgets/QStackedWidget/nstackedwidget.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QStackedWidget/nstackedwidget.hpp @@ -1,8 +1,9 @@ #pragma once + #include #include "Extras/Utils/nutils.h" -#include "QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QFrame/qframe_macro.h" #include "core/NodeWidget/nodewidget.h" #include "napi.h" @@ -14,7 +15,7 @@ class DLL_EXPORT NStackedWidget : public QStackedWidget, public NodeWidget { // QStackedWidget void connectSignalsToEventEmitter() { - QWIDGET_SIGNALS + QFRAME_SIGNALS // Qt Connects: Implement all signal connects here QObject::connect(this, &QStackedWidget::currentChanged, [=](int index) { Napi::Env env = this->emitOnNode.Env(); diff --git a/src/cpp/include/nodegui/QtWidgets/QStackedWidget/qstackedwidget_wrap.h b/src/cpp/include/nodegui/QtWidgets/QStackedWidget/qstackedwidget_wrap.h index 42b681c36..f141d8dcd 100644 --- a/src/cpp/include/nodegui/QtWidgets/QStackedWidget/qstackedwidget_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QStackedWidget/qstackedwidget_wrap.h @@ -5,12 +5,12 @@ #include #include "Extras/Utils/nutils.h" +#include "QtWidgets/QFrame/qframe_macro.h" #include "QtWidgets/QStackedWidget/nstackedwidget.hpp" -#include "QtWidgets/QWidget/qwidget_macro.h" class DLL_EXPORT QStackedWidgetWrap : public Napi::ObjectWrap { - QWIDGET_WRAPPED_METHODS_DECLARATION + QFRAME_WRAPPED_METHODS_DECLARATION private: QPointer instance; diff --git a/src/cpp/lib/QtWidgets/QFrame/qframe_wrap.cpp b/src/cpp/lib/QtWidgets/QFrame/qframe_wrap.cpp new file mode 100644 index 000000000..2aa5d4141 --- /dev/null +++ b/src/cpp/lib/QtWidgets/QFrame/qframe_wrap.cpp @@ -0,0 +1,40 @@ +#include "QtWidgets/QFrame/qframe_wrap.h" + +#include "Extras/Utils/nutils.h" + +Napi::FunctionReference QFrameWrap::constructor; + +Napi::Object QFrameWrap::init(Napi::Env env, Napi::Object exports) { + Napi::HandleScope scope(env); + char CLASSNAME[] = "QFrame"; + Napi::Function func = DefineClass( + env, CLASSNAME, {QFRAME_WRAPPED_METHODS_EXPORT_DEFINE(QFrameWrap)}); + constructor = Napi::Persistent(func); + exports.Set(CLASSNAME, func); + return exports; +} + +NFrame* QFrameWrap::getInternalInstance() { return this->instance; } + +QFrameWrap::~QFrameWrap() { extrautils::safeDelete(this->instance); } + +QFrameWrap::QFrameWrap(const Napi::CallbackInfo& info) + : Napi::ObjectWrap(info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + + if (info.Length() == 1) { + Napi::Object parentObject = info[0].As(); + QWidgetWrap* parentWidgetWrap = + Napi::ObjectWrap::Unwrap(parentObject); + this->instance = new NFrame(parentWidgetWrap->getInternalInstance()); + } else if (info.Length() == 0) { + this->instance = new NFrame(); + } else { + Napi::TypeError::New(env, "Wrong number of arguments") + .ThrowAsJavaScriptException(); + } + this->rawData = extrautils::configureQWidget( + this->getInternalInstance(), this->getInternalInstance()->getFlexNode(), + false); +} diff --git a/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp b/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp index 5ac1077f0..2f428017a 100644 --- a/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp @@ -24,7 +24,7 @@ Napi::Object QLabelWrap::init(Napi::Env env, Napi::Object exports) { InstanceMethod("setNumInt", &QLabelWrap::setNumInt), InstanceMethod("setPicture", &QLabelWrap::setPicture), InstanceMethod("setPixmap", &QLabelWrap::setPixmap), - QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QLabelWrap)}); + QFRAME_WRAPPED_METHODS_EXPORT_DEFINE(QLabelWrap)}); constructor = Napi::Persistent(func); exports.Set(CLASSNAME, func); return exports; diff --git a/src/cpp/lib/QtWidgets/QStackedWidget/qstackedwidget_wrap.cpp b/src/cpp/lib/QtWidgets/QStackedWidget/qstackedwidget_wrap.cpp index 071d898f5..46b57690c 100644 --- a/src/cpp/lib/QtWidgets/QStackedWidget/qstackedwidget_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QStackedWidget/qstackedwidget_wrap.cpp @@ -18,7 +18,7 @@ Napi::Object QStackedWidgetWrap::init(Napi::Env env, Napi::Object exports) { InstanceMethod("currentIndex", &QStackedWidgetWrap::currentIndex), InstanceMethod("setCurrentWidget", &QStackedWidgetWrap::setCurrentWidget), - QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QStackedWidgetWrap)}); + QFRAME_WRAPPED_METHODS_EXPORT_DEFINE(QStackedWidgetWrap)}); constructor = Napi::Persistent(func); exports.Set(CLASSNAME, func); return exports; diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index a5073da9e..e07c4f0ee 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -37,6 +37,7 @@ #include "QtWidgets/QDial/qdial_wrap.h" #include "QtWidgets/QDialog/qdialog_wrap.h" #include "QtWidgets/QFileDialog/qfiledialog_wrap.h" +#include "QtWidgets/QFrame/qframe_wrap.h" #include "QtWidgets/QGridLayout/qgridlayout_wrap.h" #include "QtWidgets/QGroupBox/qgroupbox_wrap.h" #include "QtWidgets/QInputDialog/qinputdialog_wrap.h" @@ -111,6 +112,7 @@ Napi::Object Main(Napi::Env env, Napi::Object exports) { QDateEditWrap::init(env, exports); QDateTimeEditWrap::init(env, exports); QFileDialogWrap::init(env, exports); + QFrameWrap::init(env, exports); QListWidgetWrap::init(env, exports); QListWidgetItemWrap::init(env, exports); QTableViewWrap::init(env, exports); diff --git a/src/demo.ts b/src/demo.ts index 36371c180..1b87a64cb 100644 --- a/src/demo.ts +++ b/src/demo.ts @@ -2,23 +2,15 @@ import { QTableView } from './lib/QtWidgets/QTableView'; import { QWidget } from './lib/QtWidgets/QWidget'; import { FlexLayout } from './lib/core/FlexLayout'; import { QTableWidget } from './lib/QtWidgets/QTableWidget'; - -// the code commented below have no problem -/*const view = new QTableView(); - -view.setStyleSheet(` -QTableView { - min-width:300px; - min-height:200px; -} -`); -view.show(); -*/ +import { QFrame, Shape } from './lib/QtWidgets/QFrame'; const widget = new QWidget(); const layout = new FlexLayout(); const view = new QTableView(); const table = new QTableWidget(5, 5); +const frame = new QFrame(); + +frame.setFrameShape(Shape.HLine); view.setStyleSheet(` QTableView { @@ -34,13 +26,21 @@ QTableView { } `); +frame.setStyleSheet(` + QFrame{ + background: blue; + border: none; + height:15px; + } + `); + widget.setLayout(layout); -layout.addWidget(view); // app crash when add view to the layout -layout.addWidget(table); // app run ok when add table to the layout +layout.addWidget(view); +layout.addWidget(frame); +layout.addWidget(table); widget.setInlineStyle('flex:1;'); widget.resize(600, 400); widget.show(); -//(global as any).main = view; (global as any).main = widget; diff --git a/src/index.ts b/src/index.ts index 8381759ca..175b4a8f6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,6 +41,7 @@ export { QDateTimeEdit, NodeDateTimeEdit, QDateTimeEditSignals } from './lib/QtW export { QLabel, QLabelSignals } from './lib/QtWidgets/QLabel'; export { QDial, QDialSignals } from './lib/QtWidgets/QDial'; export { QFileDialog, QFileDialogSignals } from './lib/QtWidgets/QFileDialog'; +export { QFrame, QFrameSignals, Shadow, Shape } from './lib/QtWidgets/QFrame'; export { QLineEdit, QLineEditSignals, EchoMode } from './lib/QtWidgets/QLineEdit'; export { QMainWindow, QMainWindowSignals } from './lib/QtWidgets/QMainWindow'; export { QProgressBar, QProgressBarSignals, QProgressBarDirection } from './lib/QtWidgets/QProgressBar'; diff --git a/src/lib/QtWidgets/QAbstractScrollArea.ts b/src/lib/QtWidgets/QAbstractScrollArea.ts index 1bfcd335f..752d36d83 100644 --- a/src/lib/QtWidgets/QAbstractScrollArea.ts +++ b/src/lib/QtWidgets/QAbstractScrollArea.ts @@ -1,4 +1,5 @@ -import { NodeWidget, QWidget, QWidgetSignals } from './QWidget'; +import { NodeWidget, QWidget } from './QWidget'; +import { NodeFrame, QFrameSignals } from './QFrame'; import { ScrollBarPolicy } from '../QtEnums/ScrollBarPolicy'; /** @@ -14,7 +15,7 @@ import { ScrollBarPolicy } from '../QtEnums/ScrollBarPolicy'; QAbstractScrollArea will list all methods and properties that are common to all scrollable widgets in the NodeGui world. */ -export abstract class QAbstractScrollArea extends NodeWidget { +export abstract class QAbstractScrollArea extends NodeFrame { viewportWidget?: NodeWidget; setViewport(widget: NodeWidget): void { this.viewportWidget = widget; @@ -34,4 +35,4 @@ export abstract class QAbstractScrollArea extends NodeWidget { + setFrameRect(r: QRect): void { + this.setProperty('frameRect', r.native); + } + frameRect(): QRect { + return QRect.fromQVariant(this.property('frameRect')); + } + setFrameShadow(type: Shadow): void { + this.setProperty('frameShadow', type); + } + frameShadow(): Shadow { + return this.property('frameShadow').toInt(); + } + setFrameShape(type: Shape): void { + this.setProperty('frameShape', type); + } + frameShape(): Shape { + return this.property('frameShape').toInt(); + } + frameWidth(): number { + return this.property('frameWidth').toInt(); + } + setLineWidth(width: number): void { + this.setProperty('lineWidth', width); + } + lineWidth(): number { + return this.property('lineWidth').toInt(); + } + setMidLineWidth(width: number): void { + this.setProperty('midLineWidth', width); + } + midLineWidth(): number { + return this.property('midLineWidth').toInt(); + } + setFrameStyle(style: number): void { + this.native.setFrameStyle(style); + } + frameStyle(): number { + return this.native.frameStyle(); + } +} + +export enum Shadow { + Plain = 0x0010, + Raised = 0x0020, + Sunken = 0x0030, +} + +export enum Shape { + NoFrame = 0, + Box = 0x0001, + Panel = 0x0002, + WinPanel = 0x0003, + HLine = 0x0004, + VLine = 0x0005, + StyledPanel = 0x0006, +} + +export type QFrameSignals = QWidgetSignals; + +/** + > Create and control frame. + +* **This class is a JS wrapper around Qt's [QFrame class](https://doc.qt.io/qt-5/qframe.html)** + +The QFrame class is the base class of widgets that can have a frame. It can be used directly for creating simple placeholder frames without any contents. + +### Example + +```javascript +const { QFrame } = require("@nodegui/nodegui"); + +const frame = new QFrame(); +``` + */ +export class QFrame extends NodeFrame { + native: NativeElement; + constructor(arg?: NodeWidget | NativeElement) { + let native; + let parent; + if (checkIfNativeElement(arg)) { + native = arg as NativeElement; + } else if (arg as NodeWidget) { + parent = arg as NodeWidget; + native = new addon.QFrame(parent.native); + } else { + native = new addon.QFrame(); + } + super(native); + this.setNodeParent(parent); + this.native = native; + } +} diff --git a/src/lib/QtWidgets/QLabel.ts b/src/lib/QtWidgets/QLabel.ts index fa20e313e..ed65bea94 100644 --- a/src/lib/QtWidgets/QLabel.ts +++ b/src/lib/QtWidgets/QLabel.ts @@ -1,5 +1,6 @@ import addon from '../utils/addon'; -import { NodeWidget, QWidgetSignals } from './QWidget'; +import { NodeWidget } from './QWidget'; +import { NodeFrame, QFrameSignals } from './QFrame'; import { NativeElement } from '../core/Component'; import { QPixmap } from '../QtGui/QPixmap'; import { QMovie } from '../QtGui/QMovie'; @@ -26,7 +27,7 @@ label.setText("Hello"); ``` */ -export class QLabel extends NodeWidget { +export class QLabel extends NodeFrame { native: NativeElement; private _picture?: QPicture; private _pixmap?: QPixmap; @@ -153,7 +154,7 @@ export class QLabel extends NodeWidget { } } -export interface QLabelSignals extends QWidgetSignals { +export interface QLabelSignals extends QFrameSignals { linkActivated: (link: string) => void; linkHovered: (link: string) => void; } diff --git a/src/lib/QtWidgets/QStackedWidget.ts b/src/lib/QtWidgets/QStackedWidget.ts index cddfaaf19..ac0fa0785 100644 --- a/src/lib/QtWidgets/QStackedWidget.ts +++ b/src/lib/QtWidgets/QStackedWidget.ts @@ -1,5 +1,6 @@ import addon from '../utils/addon'; -import { NodeWidget, QWidgetSignals } from './QWidget'; +import { NodeWidget } from './QWidget'; +import { NodeFrame, QFrameSignals } from './QFrame'; import { NativeElement } from '../core/Component'; /** @@ -43,7 +44,7 @@ win.show(); ``` */ -export class QStackedWidget extends NodeWidget { +export class QStackedWidget extends NodeFrame { native: NativeElement; constructor(); constructor(parent: NodeWidget); @@ -83,6 +84,6 @@ export class QStackedWidget extends NodeWidget { } } -export interface QStackedWidgetSignals extends QWidgetSignals { +export interface QStackedWidgetSignals extends QFrameSignals { currentChanged: (index: number) => void; }