avoid arrow function; fix wrapper type

This commit is contained in:
王劲鹏 2021-04-07 10:41:34 +08:00 committed by osborn
parent 42b7d0723d
commit 5229e04752
5 changed files with 28 additions and 24 deletions

View File

@ -6,7 +6,7 @@ import "util.mjs" as Util
import "gravity.mjs" as Gravity import "gravity.mjs" as Gravity
Rectangle { Rectangle {
property int wrapper: 0 property var wrapper
clip: true clip: true
@ -19,15 +19,15 @@ Rectangle {
property int childrenRectWidth: childrenRect.width property int childrenRectWidth: childrenRect.width
property int childrenRectHeight: childrenRect.height property int childrenRectHeight: childrenRect.height
onWidthChanged: () => { onWidthChanged: {
console.log(tag, uuid + " onWidthChanged: " + this.width) console.log(tag, uuid + " onWidthChanged: " + this.width)
} }
onHeightChanged: () => { onHeightChanged: {
console.log(tag, uuid + " onHeightChanged: " + this.height) console.log(tag, uuid + " onHeightChanged: " + this.height)
} }
onWidthSpecChanged: () => { onWidthSpecChanged: {
console.log(tag, uuid + " onWidthSpecChanged: " + this.widthSpec) console.log(tag, uuid + " onWidthSpecChanged: " + this.widthSpec)
console.log(tag, uuid + " parent width: " + parent.width) console.log(tag, uuid + " parent width: " + parent.width)
@ -37,7 +37,7 @@ Rectangle {
} }
} }
onHeightSpecChanged: () => { onHeightSpecChanged: {
console.log(tag, uuid + " onHeightSpecChanged: " + this.heightSpec) console.log(tag, uuid + " onHeightSpecChanged: " + this.heightSpec)
console.log(tag, uuid + " parent height: " + parent.height) console.log(tag, uuid + " parent height: " + parent.height)
@ -47,7 +47,7 @@ Rectangle {
} }
} }
onChildrenRectChanged: () => { onChildrenRectChanged: {
console.log(tag, uuid + " widthSpec: " + widthSpec + " heightSpec: " + heightSpec) console.log(tag, uuid + " widthSpec: " + widthSpec + " heightSpec: " + heightSpec)
console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect) console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect)
this.childrenRectWidth = childrenRect.width this.childrenRectWidth = childrenRect.width
@ -67,6 +67,7 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log(tag, uuid + " wrapper: " + wrapper)
mouseAreaBridge.onClick(wrapper) mouseAreaBridge.onClick(wrapper)
} }
} }
@ -76,7 +77,7 @@ Rectangle {
spacing: 0 spacing: 0
onChildrenChanged: () => { onChildrenChanged: {
console.log(tag, uuid + " gravity: " + gravity) console.log(tag, uuid + " gravity: " + gravity)
for (var i = 0;i !== children.length;i++) { for (var i = 0;i !== children.length;i++) {
switch(this.gravity) { switch(this.gravity) {

View File

@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15
import "util.mjs" as Util import "util.mjs" as Util
Rectangle { Rectangle {
property int wrapper: 0 property var wrapper
clip: true clip: true
@ -18,15 +18,15 @@ Rectangle {
property var tag: "Stack" property var tag: "Stack"
onWidthChanged: () => { onWidthChanged: {
console.log(tag, uuid + " onWidthChanged: " + this.width) console.log(tag, uuid + " onWidthChanged: " + this.width)
} }
onHeightChanged: () => { onHeightChanged: {
console.log(tag, uuid + " onHeightChanged: " + this.height) console.log(tag, uuid + " onHeightChanged: " + this.height)
} }
onWidthSpecChanged: () => { onWidthSpecChanged: {
console.log(tag, uuid + " onWidthSpecChanged: " + this.widthSpec) console.log(tag, uuid + " onWidthSpecChanged: " + this.widthSpec)
console.log(tag, uuid + " parent width: " + parent.width) console.log(tag, uuid + " parent width: " + parent.width)
if (this.widthSpec === 2) { if (this.widthSpec === 2) {
@ -34,7 +34,7 @@ Rectangle {
} }
} }
onHeightSpecChanged: () => { onHeightSpecChanged: {
console.log(tag, uuid + " onHeightSpecChanged: " + this.heightSpec) console.log(tag, uuid + " onHeightSpecChanged: " + this.heightSpec)
console.log(tag, uuid + " parent height: " + parent.height) console.log(tag, uuid + " parent height: " + parent.height)
@ -43,7 +43,7 @@ Rectangle {
} }
} }
onChildrenRectChanged: () => { onChildrenRectChanged: {
console.log(tag, uuid + " widthSpec: " + widthSpec + " heightSpec: " + heightSpec) console.log(tag, uuid + " widthSpec: " + widthSpec + " heightSpec: " + heightSpec)
console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect) console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect)
this.childrenRectWidth = childrenRect.width this.childrenRectWidth = childrenRect.width
@ -63,6 +63,7 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log(tag, uuid + " wrapper: " + wrapper)
mouseAreaBridge.onClick(wrapper) mouseAreaBridge.onClick(wrapper)
} }
} }

View File

@ -14,15 +14,15 @@ Rectangle {
property var tag: "Text" property var tag: "Text"
onWidthChanged: () => { onWidthChanged: {
console.log(tag, uuid + " onWidthChanged: " + this.width) console.log(tag, uuid + " onWidthChanged: " + this.width)
} }
onHeightChanged: () => { onHeightChanged: {
console.log(tag, uuid + " onHeightChanged: " + this.height) console.log(tag, uuid + " onHeightChanged: " + this.height)
} }
onChildrenRectChanged: () => { onChildrenRectChanged: {
console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect) console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect)
this.childrenRectWidth = childrenRect.width this.childrenRectWidth = childrenRect.width
this.childrenRectHeight = childrenRect.height this.childrenRectHeight = childrenRect.height
@ -54,6 +54,7 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log(tag, uuid + " wrapper: " + wrapper)
mouseAreaBridge.onClick(wrapper) mouseAreaBridge.onClick(wrapper)
} }
} }

View File

@ -6,7 +6,7 @@ import "util.mjs" as Util
import "gravity.mjs" as Gravity import "gravity.mjs" as Gravity
Rectangle { Rectangle {
property int wrapper: 0 property var wrapper
clip: true clip: true
@ -19,15 +19,15 @@ Rectangle {
property int childrenRectWidth: childrenRect.width property int childrenRectWidth: childrenRect.width
property int childrenRectHeight: childrenRect.height property int childrenRectHeight: childrenRect.height
onWidthChanged: () => { onWidthChanged: {
console.log(tag, uuid + " onWidthChanged: " + this.width) console.log(tag, uuid + " onWidthChanged: " + this.width)
} }
onHeightChanged: () => { onHeightChanged: {
console.log(tag, uuid + " onHeightChanged: " + this.height) console.log(tag, uuid + " onHeightChanged: " + this.height)
} }
onWidthSpecChanged: () => { onWidthSpecChanged: {
console.log(tag, uuid + " onWidthSpecChanged: " + this.widthSpec) console.log(tag, uuid + " onWidthSpecChanged: " + this.widthSpec)
console.log(tag, uuid + " parent width: " + parent.width) console.log(tag, uuid + " parent width: " + parent.width)
@ -37,7 +37,7 @@ Rectangle {
} }
} }
onHeightSpecChanged: () => { onHeightSpecChanged: {
console.log(tag, uuid + " onHeightSpecChanged: " + this.heightSpec) console.log(tag, uuid + " onHeightSpecChanged: " + this.heightSpec)
console.log(tag, uuid + " parent height: " + parent.height) console.log(tag, uuid + " parent height: " + parent.height)
@ -47,7 +47,7 @@ Rectangle {
} }
} }
onChildrenRectChanged: () => { onChildrenRectChanged: {
console.log(tag, uuid + " widthSpec: " + widthSpec + " heightSpec: " + heightSpec) console.log(tag, uuid + " widthSpec: " + widthSpec + " heightSpec: " + heightSpec)
console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect) console.log(tag, uuid + " onChildrenRectChanged: " + childrenRect)
this.childrenRectWidth = childrenRect.width this.childrenRectWidth = childrenRect.width
@ -67,6 +67,7 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.log(tag, uuid + " wrapper: " + wrapper)
mouseAreaBridge.onClick(wrapper) mouseAreaBridge.onClick(wrapper)
} }
} }
@ -76,7 +77,7 @@ Rectangle {
spacing: 0 spacing: 0
onChildrenChanged: () => { onChildrenChanged: {
console.log(tag, uuid + " gravity: " + gravity) console.log(tag, uuid + " gravity: " + gravity)
for (var i = 0;i !== children.length;i++) { for (var i = 0;i !== children.length;i++) {

View File

@ -118,7 +118,7 @@ void DoricViewNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
} else if (name == "onClick") { } else if (name == "onClick") {
if (prop.isString()) if (prop.isString())
clickFunction = prop.toString(); clickFunction = prop.toString();
} else { } else if (name != "layoutConfig") {
qCritical() << name << ": " << prop.toString(); qCritical() << name << ": " << prop.toString();
} }
} }