diff --git a/src/lib/QtGui/QWidget/index.ts b/src/lib/QtGui/QWidget/index.ts index ba65874df..4033c339a 100644 --- a/src/lib/QtGui/QWidget/index.ts +++ b/src/lib/QtGui/QWidget/index.ts @@ -1,10 +1,12 @@ import addon from "../../core/addon"; -import { QLayout } from "../../QtWidgets/QLayout"; import { YogaWidget } from "../../core/YogaWidget"; +import { NodeLayout } from "../../QtWidgets/QLayout"; // Implement all native QWidget methods here so that all widgets get access to those aswell +// All Widgets should extend from NodeWidget export abstract class NodeWidget extends YogaWidget { - abstract layout?: QLayout; + type = "widget"; + layout?: NodeLayout; show() { this.native.show(); } @@ -14,7 +16,7 @@ export abstract class NodeWidget extends YogaWidget { close() { this.native.close(); } - setLayout(parentLayout: QLayout) { + setLayout(parentLayout: NodeLayout) { this.native.setLayout(parentLayout.native); this.layout = parentLayout; } @@ -27,7 +29,6 @@ export abstract class NodeWidget extends YogaWidget { } export class QWidget extends NodeWidget { - layout?: QLayout; native: any; constructor(parent?: QWidget) { super(); diff --git a/src/lib/QtWidgets/QCheckBox/index.ts b/src/lib/QtWidgets/QCheckBox/index.ts index 1b53fb37b..26f8fe2bb 100644 --- a/src/lib/QtWidgets/QCheckBox/index.ts +++ b/src/lib/QtWidgets/QCheckBox/index.ts @@ -1,10 +1,7 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; - export class QCheckBox extends NodeWidget { native: any; - layout?: QLayout; constructor(parent?: NodeWidget) { super(); if (parent) { diff --git a/src/lib/QtWidgets/QGridLayout/index.ts b/src/lib/QtWidgets/QGridLayout/index.ts index 59dc45945..aca4a2578 100644 --- a/src/lib/QtWidgets/QGridLayout/index.ts +++ b/src/lib/QtWidgets/QGridLayout/index.ts @@ -1,8 +1,8 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; +import { NodeLayout } from "../QLayout"; -export class QGridLayout extends QLayout { +export class QGridLayout extends NodeLayout { native: any; constructor(parent?: NodeWidget) { super(); diff --git a/src/lib/QtWidgets/QLabel/index.ts b/src/lib/QtWidgets/QLabel/index.ts index eb181b234..cb9683b04 100644 --- a/src/lib/QtWidgets/QLabel/index.ts +++ b/src/lib/QtWidgets/QLabel/index.ts @@ -1,11 +1,9 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; import { FlexNode } from "../../core/FlexLayout/FlexNode"; export class QLabel extends NodeWidget { native: any; - layout?: QLayout; constructor(parent?: NodeWidget) { super(); if (parent) { diff --git a/src/lib/QtWidgets/QLayout/index.ts b/src/lib/QtWidgets/QLayout/index.ts index 552b543ed..bc00f9d12 100644 --- a/src/lib/QtWidgets/QLayout/index.ts +++ b/src/lib/QtWidgets/QLayout/index.ts @@ -1,4 +1,10 @@ import { Component } from "../../core/Component"; // All Layouts should extend this abstract class. -export abstract class QLayout extends Component {} +export abstract class NodeLayout extends Component { + type: string = "Layout"; +} + +// export class QLayout extends NodeLayout { //Dont need QLayout for now +// native: any; +// } diff --git a/src/lib/QtWidgets/QLineEdit/index.ts b/src/lib/QtWidgets/QLineEdit/index.ts index 9a7890ac1..64eabf17c 100644 --- a/src/lib/QtWidgets/QLineEdit/index.ts +++ b/src/lib/QtWidgets/QLineEdit/index.ts @@ -1,10 +1,8 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; export class QLineEdit extends NodeWidget { native: any; - layout?: QLayout; constructor(parent?: NodeWidget) { super(); if (parent) { diff --git a/src/lib/QtWidgets/QMainWindow/index.ts b/src/lib/QtWidgets/QMainWindow/index.ts index 4a3ce0300..c2b6836a5 100644 --- a/src/lib/QtWidgets/QMainWindow/index.ts +++ b/src/lib/QtWidgets/QMainWindow/index.ts @@ -1,8 +1,6 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; export class QMainWindow extends NodeWidget { - layout?: QLayout; native: any; constructor(parent?: NodeWidget) { super(); diff --git a/src/lib/QtWidgets/QProgressBar/index.ts b/src/lib/QtWidgets/QProgressBar/index.ts index 2bc05ecf5..3e00b962d 100644 --- a/src/lib/QtWidgets/QProgressBar/index.ts +++ b/src/lib/QtWidgets/QProgressBar/index.ts @@ -1,10 +1,8 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; export class QProgressBar extends NodeWidget { native: any; - layout?: QLayout; constructor(parent?: NodeWidget) { super(); if (parent) { diff --git a/src/lib/QtWidgets/QPushButton/index.ts b/src/lib/QtWidgets/QPushButton/index.ts index c2f0924ea..0fd05368b 100644 --- a/src/lib/QtWidgets/QPushButton/index.ts +++ b/src/lib/QtWidgets/QPushButton/index.ts @@ -1,8 +1,6 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; export class QPushButton extends NodeWidget { - layout?: QLayout; native: any; constructor(parent?: NodeWidget) { super(); diff --git a/src/lib/QtWidgets/QRadioButton/index.ts b/src/lib/QtWidgets/QRadioButton/index.ts index bc6f56a14..28ee3d02f 100644 --- a/src/lib/QtWidgets/QRadioButton/index.ts +++ b/src/lib/QtWidgets/QRadioButton/index.ts @@ -1,10 +1,8 @@ import addon from "../../core/addon"; import { NodeWidget } from "../../QtGui/QWidget"; -import { QLayout } from "../QLayout"; export class QRadioButton extends NodeWidget { native: any; - layout?: QLayout; constructor(parent?: NodeWidget) { super(); if (parent) { diff --git a/src/lib/core/FlexLayout/FlexNode/index.ts b/src/lib/core/FlexLayout/FlexNode/index.ts index 95f65ffca..cccdc9a0a 100644 --- a/src/lib/core/FlexLayout/FlexNode/index.ts +++ b/src/lib/core/FlexLayout/FlexNode/index.ts @@ -1,6 +1,6 @@ -import { QLayout } from "../../../QtWidgets/QLayout"; +import { Component } from "../../Component"; -export class FlexNode extends QLayout { +export class FlexNode extends Component { native: any; constructor(nativeNode: any) { super(); diff --git a/src/lib/core/FlexLayout/index.ts b/src/lib/core/FlexLayout/index.ts index 25c140278..4a268918f 100644 --- a/src/lib/core/FlexLayout/index.ts +++ b/src/lib/core/FlexLayout/index.ts @@ -1,9 +1,9 @@ import addon from "../addon"; -import { Component } from "../Component"; import { QWidget } from "../../QtGui/QWidget"; import { FlexNode } from "./FlexNode"; +import { NodeLayout } from "../../QtWidgets/QLayout"; -export class FlexLayout extends Component { +export class FlexLayout extends NodeLayout { native = new addon.FlexLayout(); addWidget(childWidget: QWidget, childFlexNode: FlexNode) { this.children.add(childWidget);