fix click order
This commit is contained in:
parent
e4527f7f39
commit
a2c0a34a8a
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.14.2, 2021-04-06T10:55:52. -->
|
||||
<!-- Written by QtCreator 4.14.2, 2021-04-06T14:14:11. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -62,6 +62,7 @@ v8::Local<v8::Value> String2JS(std::string string) {
|
||||
v8::Local<v8::Value> Variant2JS(QVariant variant) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Context> context = isolate->GetEnteredOrMicrotaskContext();
|
||||
|
||||
v8::Local<v8::Value> jsValue;
|
||||
if (variant.type() == QVariant::String) {
|
||||
@ -78,7 +79,14 @@ v8::Local<v8::Value> Variant2JS(QVariant variant) {
|
||||
QString strJson(doc.toJson(QJsonDocument::Compact));
|
||||
jsValue = String2JS(strJson.toUtf8().constData());
|
||||
} else if (variant.type() == QVariant::StringList) {
|
||||
qDebug() << "";
|
||||
QStringList list = variant.toStringList();
|
||||
v8::Handle<v8::Array> array = v8::Array::New(isolate, list.size());
|
||||
for (int i = 0; i != list.size(); i++) {
|
||||
v8::Local<v8::Value> value = NewV8String(list.at(i).toUtf8().constData());
|
||||
auto result = array->Set(context, i, value);
|
||||
result.ToChecked();
|
||||
}
|
||||
jsValue = array;
|
||||
}
|
||||
return handle_scope.Escape(jsValue);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "util.mjs" as Util
|
||||
import "gravity.mjs" as Gravity
|
||||
|
||||
Rectangle {
|
||||
property int wrapper: 0
|
||||
property var wrapper
|
||||
|
||||
property var uuid: Util.uuidv4()
|
||||
property int childrenRectWidth: childrenRect.width
|
||||
|
@ -11,7 +11,7 @@ QQuickItem *DoricHLayoutNode::build() {
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
item->setProperty("wrapper", (qint64)this);
|
||||
item->setProperty("wrapper", QString::number((qint64)this));
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ QQuickItem *DoricStackNode::build() {
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
item->setProperty("wrapper", (qint64)this);
|
||||
item->setProperty("wrapper", QString::number((qint64)this));
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,8 @@ QQuickItem *DoricTextNode::build() {
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
item->setProperty("wrapper", (qint64)this);
|
||||
|
||||
item->setProperty("wrapper", QString::number((qint64)this));
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ QQuickItem *DoricVLayoutNode::build() {
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
item->setProperty("wrapper", (qint64)this);
|
||||
item->setProperty("wrapper", QString::number((qint64)this));
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ QList<QString> DoricViewNode::getIdList() {
|
||||
|
||||
DoricViewNode *viewNode = this;
|
||||
do {
|
||||
ids.append(viewNode->mId);
|
||||
ids.insert(0, viewNode->mId);
|
||||
viewNode = viewNode->mSuperNode;
|
||||
} while (viewNode != nullptr);
|
||||
|
||||
|
@ -21,7 +21,7 @@ class DoricViewNode : public DoricContextHolder {
|
||||
protected:
|
||||
QQuickItem *mView;
|
||||
|
||||
DoricSuperNode *mSuperNode;
|
||||
DoricSuperNode *mSuperNode = nullptr;
|
||||
|
||||
virtual QQuickItem *build() = 0;
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
DoricMouseAreaBridge::DoricMouseAreaBridge(QObject *parent) : QObject(parent) {}
|
||||
|
||||
void DoricMouseAreaBridge::onClick(qint64 pointer) {
|
||||
QObject *object = (QObject *)(pointer);
|
||||
void DoricMouseAreaBridge::onClick(QString pointer) {
|
||||
QObject *object = (QObject *)(pointer.toULongLong());
|
||||
DoricViewNode *viewNode = dynamic_cast<DoricViewNode *>(object);
|
||||
viewNode->onClick();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public:
|
||||
explicit DoricMouseAreaBridge(QObject *parent = nullptr);
|
||||
|
||||
Q_INVOKABLE
|
||||
void onClick(qint64 pointer);
|
||||
void onClick(QString pointer);
|
||||
signals:
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user