add on focus change
This commit is contained in:
parent
2782552b41
commit
6f5174df60
@ -90,6 +90,8 @@ v8::Local<v8::Value> Variant2JS(QVariant variant) {
|
||||
jsValue = array;
|
||||
} else if (variant.type() == QVariant::Int) {
|
||||
jsValue = v8::Number::New(isolate, variant.toDouble());
|
||||
} else if (variant.type() == QVariant::Bool) {
|
||||
jsValue = v8::Boolean::New(isolate, variant.toBool());
|
||||
} else if (variant.type() == QVariant::Invalid) {
|
||||
jsValue = v8::Undefined(isolate);
|
||||
}
|
||||
|
@ -67,6 +67,11 @@ TextArea {
|
||||
inputBridge.onTextChange(wrapper, this.text)
|
||||
}
|
||||
|
||||
onFocusChanged: {
|
||||
console.log(tag, uuid + " onFocusChanged: " + this.focus)
|
||||
inputBridge.onFocusChange(wrapper, this.focus)
|
||||
}
|
||||
|
||||
property var borderWidth: 0
|
||||
onBorderWidthChanged: {
|
||||
bg.border.width = borderWidth
|
||||
|
@ -64,3 +64,11 @@ void DoricInputNode::onTextChange(QString text) {
|
||||
callJSResponse(onTextChangeId, args);
|
||||
}
|
||||
}
|
||||
|
||||
void DoricInputNode::onFocusChange(bool hasFocus) {
|
||||
if (!onFocusChangeId.isEmpty()) {
|
||||
QVariantList args;
|
||||
args.append(hasFocus);
|
||||
callJSResponse(onFocusChangeId, args);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
QSizeF sizeThatFits(QSizeF size);
|
||||
|
||||
void onTextChange(QString text);
|
||||
|
||||
void onFocusChange(bool hasFocus);
|
||||
};
|
||||
|
||||
#endif // DORICINPUTNODE_H
|
||||
|
@ -11,7 +11,9 @@ void DoricInputBridge::onTextChange(QString pointer, QString text) {
|
||||
inputNode->onTextChange(text);
|
||||
}
|
||||
|
||||
void DoricInputBridge::onFocusChange(QString pointer) {
|
||||
void DoricInputBridge::onFocusChange(QString pointer, bool hasFocus) {
|
||||
QObject *object = (QObject *)(pointer.toULongLong());
|
||||
DoricInputNode *inputNode = dynamic_cast<DoricInputNode *>(object);
|
||||
|
||||
inputNode->onFocusChange(hasFocus);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
void onTextChange(QString pointer, QString text);
|
||||
|
||||
Q_INVOKABLE
|
||||
void onFocusChange(QString pointer);
|
||||
void onFocusChange(QString pointer, bool hasFocus);
|
||||
signals:
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user