add some props handle

This commit is contained in:
王劲鹏 2021-05-26 17:50:32 +08:00 committed by osborn
parent 1d4667b347
commit f56a78b452

View File

@ -1,4 +1,5 @@
#include "DoricInputNode.h" #include "DoricInputNode.h"
#include "../utils/DoricUtils.h"
QQuickItem *DoricInputNode::build() { QQuickItem *DoricInputNode::build() {
QQmlComponent component(getContext()->getQmlEngine()); QQmlComponent component(getContext()->getQmlEngine());
@ -18,7 +19,16 @@ QQuickItem *DoricInputNode::build() {
} }
void DoricInputNode::blend(QQuickItem *view, QString name, QJsonValue prop) { void DoricInputNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
if (name == "hintText") { if (name == "text") {
view->setProperty("text", prop.toString());
} else if (name == "textColor") {
QString color = DoricUtils::doricColor(prop.toInt()).name();
view->setProperty("color", color);
} else if (name == "textSize") {
QFont font = view->property("font").value<QFont>();
font.setPixelSize(prop.toInt());
view->setProperty("font", QVariant(font));
} else if (name == "hintText") {
view->setProperty("placeholderText", prop.toString()); view->setProperty("placeholderText", prop.toString());
} else if (name == "textAlignment") { } else if (name == "textAlignment") {
view->setProperty("textAlignment", prop.toInt()); view->setProperty("textAlignment", prop.toInt());