panel to flex, text stack wrap with flex
This commit is contained in:
parent
692397be2e
commit
6c8c3d69bc
@ -6,12 +6,8 @@
|
||||
#include "shader/DoricStackNode.h"
|
||||
#include "shader/DoricTextNode.h"
|
||||
#include "shader/DoricVLayoutNode.h"
|
||||
#include "widget/flex/FlexLayoutService.h"
|
||||
|
||||
DoricRegistry::DoricRegistry() {
|
||||
qmlRegisterType<FlexLayoutService>("pub.doric.widget", 1, 0,
|
||||
"FlexLayoutService");
|
||||
|
||||
registerNativePlugin<DoricShaderPlugin>("shader");
|
||||
|
||||
registerViewNode<DoricRootNode>("Root");
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <QQmlContext>
|
||||
|
||||
#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<FlexLayoutService>("pub.doric.widget", 1, 0,
|
||||
"FlexLayoutService");
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ Flex {
|
||||
flexDirection: "row"
|
||||
justifyContent: "flexStart"
|
||||
alignItems: "flexStart"
|
||||
alignContent: "stretch"
|
||||
alignContent: "flexStart"
|
||||
}
|
||||
|
@ -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'
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Rectangle {
|
||||
Flex {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Text {
|
||||
Flex {
|
||||
Text {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,5 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Rectangle {
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,6 @@ Flex {
|
||||
flexDirection: "column"
|
||||
justifyContent: "flexStart"
|
||||
alignItems: "flexStart"
|
||||
alignContent: "stretch"
|
||||
alignContent: "flexStart"
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user