From d79ba0620d67b0760139c6c909368a486fe9c9a7 Mon Sep 17 00:00:00 2001 From: Atul R Date: Sun, 8 Dec 2019 22:33:27 +0100 Subject: [PATCH] bugifx: layout insertion and qvariant (#255) --- package-lock.json | 2 +- package.json | 2 +- src/lib/QtCore/QVariant.ts | 6 +++--- src/lib/core/FlexLayout.ts | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70a872ad8..0b882d965 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@nodegui/nodegui", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 528f89893..82072d78a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nodegui/nodegui", - "version": "0.9.0", + "version": "0.9.1", "description": "A cross platform library to build native desktop apps.", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/lib/QtCore/QVariant.ts b/src/lib/QtCore/QVariant.ts index 458d21ac2..59bceaf97 100644 --- a/src/lib/QtCore/QVariant.ts +++ b/src/lib/QtCore/QVariant.ts @@ -20,13 +20,13 @@ export class QVariant extends Component { toString(): string { return this.native.toString(); } - toInt(): string { + toInt(): number { return this.native.toInt(); } - toDouble(): string { + toDouble(): number { return this.native.toDouble(); } - toBool(): string { + toBool(): boolean { return this.native.toBool(); } } diff --git a/src/lib/core/FlexLayout.ts b/src/lib/core/FlexLayout.ts index 767463bfe..d0f3015ea 100644 --- a/src/lib/core/FlexLayout.ts +++ b/src/lib/core/FlexLayout.ts @@ -14,10 +14,10 @@ export class FlexLayout extends NodeLayout { protected flexNode?: FlexNode; addWidget(childWidget: NodeWidget, childFlexNode?: FlexNode): void { - if (this.nodeChildren.has(childWidget)) { - return; - } const childYogaNode = childFlexNode || childWidget.getFlexNode(); + if (this.nodeChildren.has(childWidget)) { + this.removeWidget(childWidget, childYogaNode); + } this.nodeChildren.add(childWidget); this.native.addWidget(childWidget.native, childYogaNode); } @@ -28,10 +28,10 @@ export class FlexLayout extends NodeLayout { childFlexNode?: FlexNode, beforeChildFlexNode?: FlexNode, ): void { - if (this.nodeChildren.has(childWidget)) { - return; - } const childYogaNode = childFlexNode || childWidget.getFlexNode(); + if (this.nodeChildren.has(childWidget)) { + this.removeWidget(childWidget, childYogaNode); + } const beforeChildYogaNode = beforeChildFlexNode || beforeChildWidget.getFlexNode(); this.nodeChildren.add(childWidget); // No orderer required yet, so just inserting at the end. this.native.insertChildBefore(childWidget.native, beforeChildYogaNode, childYogaNode);