Fix layout heirarchy
This commit is contained in:
parent
f9a209f34a
commit
201ab3657f
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
// }
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user