add click for text stack hlayout vlayout
This commit is contained in:
parent
0784fa844c
commit
ace6d87bda
@ -6,6 +6,8 @@ import "util.mjs" as Util
|
|||||||
import "gravity.mjs" as Gravity
|
import "gravity.mjs" as Gravity
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
property int wrapper: 0
|
||||||
|
|
||||||
property var tag: "HLayout"
|
property var tag: "HLayout"
|
||||||
|
|
||||||
property var uuid: Util.uuidv4()
|
property var uuid: Util.uuidv4()
|
||||||
@ -29,7 +31,7 @@ Rectangle {
|
|||||||
|
|
||||||
if (this.widthSpec === 2) {
|
if (this.widthSpec === 2) {
|
||||||
this.width = parent.width
|
this.width = parent.width
|
||||||
// children[0].width = parent.width
|
// children[1].width = parent.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ Rectangle {
|
|||||||
|
|
||||||
if (this.heightSpec === 2) {
|
if (this.heightSpec === 2) {
|
||||||
this.height = parent.height
|
this.height = parent.height
|
||||||
children[0].height = parent.height
|
children[1].height = parent.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +62,13 @@ Rectangle {
|
|||||||
|
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
mouseAreaBridge.onClick(wrapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
property int gravity: 0
|
property int gravity: 0
|
||||||
|
|
||||||
|
@ -5,7 +5,10 @@ import QtQuick.Layouts 1.15
|
|||||||
import "util.mjs" as Util
|
import "util.mjs" as Util
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
property int wrapper: 0
|
||||||
|
|
||||||
property var uuid: Util.uuidv4()
|
property var uuid: Util.uuidv4()
|
||||||
|
|
||||||
property int widthSpec: 0
|
property int widthSpec: 0
|
||||||
property int heightSpec: 0
|
property int heightSpec: 0
|
||||||
property int childrenRectWidth: childrenRect.width
|
property int childrenRectWidth: childrenRect.width
|
||||||
@ -54,4 +57,11 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
mouseAreaBridge.onClick(wrapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import "util.mjs" as Util
|
|||||||
import "gravity.mjs" as Gravity
|
import "gravity.mjs" as Gravity
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
property int wrapper: 0
|
||||||
|
|
||||||
property var uuid: Util.uuidv4()
|
property var uuid: Util.uuidv4()
|
||||||
property int childrenRectWidth: childrenRect.width
|
property int childrenRectWidth: childrenRect.width
|
||||||
property int childrenRectHeight: childrenRect.width
|
property int childrenRectHeight: childrenRect.width
|
||||||
@ -52,7 +54,7 @@ Rectangle {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
mouseAreaBridge.onClick("index")
|
mouseAreaBridge.onClick(wrapper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import "util.mjs" as Util
|
|||||||
import "gravity.mjs" as Gravity
|
import "gravity.mjs" as Gravity
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
property int wrapper: 0
|
||||||
|
|
||||||
property var tag: "VLayout"
|
property var tag: "VLayout"
|
||||||
|
|
||||||
property var uuid: Util.uuidv4()
|
property var uuid: Util.uuidv4()
|
||||||
@ -29,7 +31,7 @@ Rectangle {
|
|||||||
|
|
||||||
if (this.widthSpec === 2) {
|
if (this.widthSpec === 2) {
|
||||||
this.width = parent.width
|
this.width = parent.width
|
||||||
children[0].width = parent.width
|
children[1].width = parent.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ Rectangle {
|
|||||||
|
|
||||||
if (this.heightSpec === 2) {
|
if (this.heightSpec === 2) {
|
||||||
this.height = parent.height
|
this.height = parent.height
|
||||||
// children[0].height = parent.height
|
// children[1].height = parent.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +62,13 @@ Rectangle {
|
|||||||
|
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
mouseAreaBridge.onClick(wrapper)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
property int gravity: 0
|
property int gravity: 0
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void DoricGroupNode::configChildNode() {
|
|||||||
if (mType.isEmpty() || mType == "Stack") {
|
if (mType.isEmpty() || mType == "Stack") {
|
||||||
parent = mView;
|
parent = mView;
|
||||||
} else {
|
} else {
|
||||||
parent = mView->childItems().at(0);
|
parent = mView->childItems().at(1);
|
||||||
}
|
}
|
||||||
for (int idx = 0; idx < mChildViewIds.size(); idx++) {
|
for (int idx = 0; idx < mChildViewIds.size(); idx++) {
|
||||||
QString id = mChildViewIds.at(idx);
|
QString id = mChildViewIds.at(idx);
|
||||||
|
@ -11,14 +11,15 @@ QQuickItem *DoricHLayoutNode::build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||||
|
item->setProperty("wrapper", (qint64)this);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoricHLayoutNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
void DoricHLayoutNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||||
if (name == "space") {
|
if (name == "space") {
|
||||||
view->childItems().at(0)->setProperty("spacing", prop.toInt());
|
view->childItems().at(1)->setProperty("spacing", prop.toInt());
|
||||||
} else if (name == "gravity") {
|
} else if (name == "gravity") {
|
||||||
view->childItems().at(0)->setProperty("gravity", prop.toInt());
|
view->childItems().at(1)->setProperty("gravity", prop.toInt());
|
||||||
} else {
|
} else {
|
||||||
DoricGroupNode::blend(view, name, prop);
|
DoricGroupNode::blend(view, name, prop);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ QQuickItem *DoricStackNode::build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||||
|
item->setProperty("wrapper", (qint64)this);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ QQuickItem *DoricTextNode::build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||||
|
item->setProperty("wrapper", (qint64)this);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,14 +11,15 @@ QQuickItem *DoricVLayoutNode::build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||||
|
item->setProperty("wrapper", (qint64)this);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoricVLayoutNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
void DoricVLayoutNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||||
if (name == "space") {
|
if (name == "space") {
|
||||||
view->childItems().at(0)->setProperty("spacing", prop.toInt());
|
view->childItems().at(1)->setProperty("spacing", prop.toInt());
|
||||||
} else if (name == "gravity") {
|
} else if (name == "gravity") {
|
||||||
view->childItems().at(0)->setProperty("gravity", prop.toInt());
|
view->childItems().at(1)->setProperty("gravity", prop.toInt());
|
||||||
} else {
|
} else {
|
||||||
DoricGroupNode::blend(view, name, prop);
|
DoricGroupNode::blend(view, name, prop);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ const QString DoricConstant::GLOBAL_DORIC = "doric";
|
|||||||
const QString DoricConstant::DORIC_CONTEXT_INVOKE = "jsCallEntityMethod";
|
const QString DoricConstant::DORIC_CONTEXT_INVOKE = "jsCallEntityMethod";
|
||||||
const QString DoricConstant::DORIC_TIMER_CALLBACK = "jsCallbackTimer";
|
const QString DoricConstant::DORIC_TIMER_CALLBACK = "jsCallbackTimer";
|
||||||
|
|
||||||
|
const QString DoricConstant::DORIC_ENTITY_RESPONSE = "__response__";
|
||||||
const QString DoricConstant::DORIC_ENTITY_INIT = "__init__";
|
const QString DoricConstant::DORIC_ENTITY_INIT = "__init__";
|
||||||
const QString DoricConstant::DORIC_ENTITY_CREATE = "__onCreate__";
|
const QString DoricConstant::DORIC_ENTITY_CREATE = "__onCreate__";
|
||||||
const QString DoricConstant::DORIC_ENTITY_BUILD = "__build__";
|
const QString DoricConstant::DORIC_ENTITY_BUILD = "__build__";
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
static const QString DORIC_CONTEXT_INVOKE;
|
static const QString DORIC_CONTEXT_INVOKE;
|
||||||
static const QString DORIC_TIMER_CALLBACK;
|
static const QString DORIC_TIMER_CALLBACK;
|
||||||
|
|
||||||
|
static const QString DORIC_ENTITY_RESPONSE;
|
||||||
static const QString DORIC_ENTITY_CREATE;
|
static const QString DORIC_ENTITY_CREATE;
|
||||||
static const QString DORIC_ENTITY_INIT;
|
static const QString DORIC_ENTITY_INIT;
|
||||||
static const QString DORIC_ENTITY_BUILD;
|
static const QString DORIC_ENTITY_BUILD;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#include "DoricMouseAreaBridge.h"
|
#include "DoricMouseAreaBridge.h"
|
||||||
|
#include "shader/DoricViewNode.h"
|
||||||
|
|
||||||
DoricMouseAreaBridge::DoricMouseAreaBridge(QObject *parent) : QObject(parent) {}
|
DoricMouseAreaBridge::DoricMouseAreaBridge(QObject *parent) : QObject(parent) {}
|
||||||
|
|
||||||
void DoricMouseAreaBridge::onClick(QVariant functionId) {
|
void DoricMouseAreaBridge::onClick(qint64 pointer) {
|
||||||
qCritical() << functionId;
|
QObject *object = (QObject *)(pointer);
|
||||||
|
DoricViewNode *viewNode = dynamic_cast<DoricViewNode *>(object);
|
||||||
|
qCritical() << viewNode;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public:
|
|||||||
explicit DoricMouseAreaBridge(QObject *parent = nullptr);
|
explicit DoricMouseAreaBridge(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE
|
Q_INVOKABLE
|
||||||
void onClick(QVariant functionId);
|
void onClick(qint64 pointer);
|
||||||
signals:
|
signals:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user