diff --git a/doric-Qt/doric/DoricRegistry.cpp b/doric-Qt/doric/DoricRegistry.cpp index e22e620b..e4420f08 100644 --- a/doric-Qt/doric/DoricRegistry.cpp +++ b/doric-Qt/doric/DoricRegistry.cpp @@ -6,12 +6,8 @@ #include "shader/DoricStackNode.h" #include "shader/DoricTextNode.h" #include "shader/DoricVLayoutNode.h" -#include "widget/flex/FlexLayoutService.h" DoricRegistry::DoricRegistry() { - qmlRegisterType("pub.doric.widget", 1, 0, - "FlexLayoutService"); - registerNativePlugin("shader"); registerViewNode("Root"); diff --git a/doric-Qt/doric/main.cpp b/doric-Qt/doric/main.cpp index fa86e62f..d4123f0b 100644 --- a/doric-Qt/doric/main.cpp +++ b/doric-Qt/doric/main.cpp @@ -3,6 +3,7 @@ #include #include "demo/DoricDemoBridge.h" +#include "widget/flex/FlexLayoutService.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); @@ -23,5 +24,8 @@ int main(int argc, char *argv[]) { auto context = engine.rootContext(); context->setContextProperty("demoBridge", demoBridge); engine.load(url); + + qmlRegisterType("pub.doric.widget", 1, 0, + "FlexLayoutService"); return app.exec(); } diff --git a/doric-Qt/doric/resources/hlayout.qml b/doric-Qt/doric/resources/hlayout.qml index a53222c2..83ed8129 100644 --- a/doric-Qt/doric/resources/hlayout.qml +++ b/doric-Qt/doric/resources/hlayout.qml @@ -5,5 +5,5 @@ Flex { flexDirection: "row" justifyContent: "flexStart" alignItems: "flexStart" - alignContent: "stretch" + alignContent: "flexStart" } diff --git a/doric-Qt/doric/resources/panel.qml b/doric-Qt/doric/resources/panel.qml index b6f562e9..f6d6d22d 100644 --- a/doric-Qt/doric/resources/panel.qml +++ b/doric-Qt/doric/resources/panel.qml @@ -1,6 +1,12 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 -Rectangle { +Flex { + flexDirection: "row" + justifyContent: "flexStart" + alignItems: "flexStart" + alignContent: "flexStart" + flexWrap: "noWrap" + color: 'cyan' } diff --git a/doric-Qt/doric/resources/stack.qml b/doric-Qt/doric/resources/stack.qml index b6f562e9..be34e87f 100644 --- a/doric-Qt/doric/resources/stack.qml +++ b/doric-Qt/doric/resources/stack.qml @@ -1,6 +1,6 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 -Rectangle { +Flex { } diff --git a/doric-Qt/doric/resources/text.qml b/doric-Qt/doric/resources/text.qml index 99d468df..a945e93a 100644 --- a/doric-Qt/doric/resources/text.qml +++ b/doric-Qt/doric/resources/text.qml @@ -1,6 +1,8 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 -Text { +Flex { + Text { + } } diff --git a/doric-Qt/doric/resources/view.qml b/doric-Qt/doric/resources/view.qml index 72a01878..b6f562e9 100644 --- a/doric-Qt/doric/resources/view.qml +++ b/doric-Qt/doric/resources/view.qml @@ -2,4 +2,5 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 Rectangle { + } diff --git a/doric-Qt/doric/resources/vlayout.qml b/doric-Qt/doric/resources/vlayout.qml index 207efced..6c8fb92e 100644 --- a/doric-Qt/doric/resources/vlayout.qml +++ b/doric-Qt/doric/resources/vlayout.qml @@ -5,6 +5,6 @@ Flex { flexDirection: "column" justifyContent: "flexStart" alignItems: "flexStart" - alignContent: "stretch" + alignContent: "flexStart" } diff --git a/doric-Qt/doric/shader/DoricTextNode.cpp b/doric-Qt/doric/shader/DoricTextNode.cpp index 1adc07bd..c4d95202 100644 --- a/doric-Qt/doric/shader/DoricTextNode.cpp +++ b/doric-Qt/doric/shader/DoricTextNode.cpp @@ -16,7 +16,7 @@ QQuickItem *DoricTextNode::build() { void DoricTextNode::blend(QQuickItem *view, QString name, QJSValue prop) { if (name == "text") { - view->setProperty("text", prop.toString()); + view->childItems().at(0)->setProperty("text", prop.toString()); } else { DoricViewNode::blend(view, name, prop); } diff --git a/doric-Qt/doric/shader/DoricViewNode.cpp b/doric-Qt/doric/shader/DoricViewNode.cpp index d19f57df..f037e9f3 100644 --- a/doric-Qt/doric/shader/DoricViewNode.cpp +++ b/doric-Qt/doric/shader/DoricViewNode.cpp @@ -15,8 +15,22 @@ void DoricViewNode::blendLayoutConfig(QJSValue jsObject) { qCritical() << 1; break; case 2: + qCritical() << 2; + break; + default: + qCritical() << "default"; + break; + } + } + + if (heightSpec.isNumber()) { + switch (heightSpec.toInt()) { + case 1: qCritical() << 1; break; + case 2: + qCritical() << 2; + break; default: qCritical() << "default"; break;