diff --git a/doric-Qt/example/doric/resources/text.qml b/doric-Qt/example/doric/resources/text.qml index 6006b1ac..8aaa4410 100644 --- a/doric-Qt/example/doric/resources/text.qml +++ b/doric-Qt/example/doric/resources/text.qml @@ -123,4 +123,6 @@ TextArea { color: shadowColor transparentBorder: true } + + textFormat: TextEdit.AutoText } diff --git a/doric-Qt/example/doric/shader/DoricTextNode.cpp b/doric-Qt/example/doric/shader/DoricTextNode.cpp index 6bd6e1a0..7caec8ba 100644 --- a/doric-Qt/example/doric/shader/DoricTextNode.cpp +++ b/doric-Qt/example/doric/shader/DoricTextNode.cpp @@ -18,6 +18,22 @@ QQuickItem *DoricTextNode::build() { return item; } +void DoricTextNode::blendLayoutConfig(QJsonValue jsObject) { + DoricViewNode::blendLayoutConfig(jsObject); + + DoricLayouts *layout = + (DoricLayouts *)(mView->property("doricLayout").toULongLong()); + + QJsonValue maxWidth = jsObject["maxWidth"]; + if (maxWidth.isDouble()) { + layout->setMaxWidth(maxWidth.toDouble()); + } + QJsonValue maxHeight = jsObject["maxHeight"]; + if (maxHeight.isDouble()) { + layout->setMaxHeight(maxHeight.toDouble()); + } +} + void DoricTextNode::blend(QQuickItem *view, QString name, QJsonValue prop) { if (name == "text") { view->setProperty("text", prop.toString()); @@ -39,6 +55,16 @@ void DoricTextNode::blend(QQuickItem *view, QString name, QJsonValue prop) { view->setProperty("shadowOffsetX", prop["offsetX"].toDouble()); view->setProperty("shadowOffsetY", prop["offsetY"].toDouble()); view->setProperty("shadowOpacity", prop["opacity"].toDouble()); + } else if (name == "htmlText") { + view->setProperty("text", prop.toString()); + } else if (name == "maxWidth") { + DoricLayouts *layout = + (DoricLayouts *)(mView->property("doricLayout").toULongLong()); + layout->setMaxWidth(prop.toDouble()); + } else if (name == "maxHeight") { + DoricLayouts *layout = + (DoricLayouts *)(mView->property("doricLayout").toULongLong()); + layout->setMaxHeight(prop.toDouble()); } else { DoricViewNode::blend(view, name, prop); } diff --git a/doric-Qt/example/doric/shader/DoricTextNode.h b/doric-Qt/example/doric/shader/DoricTextNode.h index 68bfdb1a..d3cabe33 100644 --- a/doric-Qt/example/doric/shader/DoricTextNode.h +++ b/doric-Qt/example/doric/shader/DoricTextNode.h @@ -11,6 +11,8 @@ public: QQuickItem *build() override; + virtual void blendLayoutConfig(QJsonValue jsObject) override; + virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override; };