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