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/DoricStackNode.h"
|
||||||
#include "shader/DoricTextNode.h"
|
#include "shader/DoricTextNode.h"
|
||||||
#include "shader/DoricVLayoutNode.h"
|
#include "shader/DoricVLayoutNode.h"
|
||||||
#include "widget/flex/FlexLayoutService.h"
|
|
||||||
|
|
||||||
DoricRegistry::DoricRegistry() {
|
DoricRegistry::DoricRegistry() {
|
||||||
qmlRegisterType<FlexLayoutService>("pub.doric.widget", 1, 0,
|
|
||||||
"FlexLayoutService");
|
|
||||||
|
|
||||||
registerNativePlugin<DoricShaderPlugin>("shader");
|
registerNativePlugin<DoricShaderPlugin>("shader");
|
||||||
|
|
||||||
registerViewNode<DoricRootNode>("Root");
|
registerViewNode<DoricRootNode>("Root");
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
|
||||||
#include "demo/DoricDemoBridge.h"
|
#include "demo/DoricDemoBridge.h"
|
||||||
|
#include "widget/flex/FlexLayoutService.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
@ -23,5 +24,8 @@ int main(int argc, char *argv[]) {
|
|||||||
auto context = engine.rootContext();
|
auto context = engine.rootContext();
|
||||||
context->setContextProperty("demoBridge", demoBridge);
|
context->setContextProperty("demoBridge", demoBridge);
|
||||||
engine.load(url);
|
engine.load(url);
|
||||||
|
|
||||||
|
qmlRegisterType<FlexLayoutService>("pub.doric.widget", 1, 0,
|
||||||
|
"FlexLayoutService");
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,5 @@ Flex {
|
|||||||
flexDirection: "row"
|
flexDirection: "row"
|
||||||
justifyContent: "flexStart"
|
justifyContent: "flexStart"
|
||||||
alignItems: "flexStart"
|
alignItems: "flexStart"
|
||||||
alignContent: "stretch"
|
alignContent: "flexStart"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.5
|
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 2.12
|
||||||
import QtQuick.Controls 2.5
|
import QtQuick.Controls 2.5
|
||||||
|
|
||||||
Rectangle {
|
Flex {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.5
|
import QtQuick.Controls 2.5
|
||||||
|
|
||||||
Text {
|
Flex {
|
||||||
|
Text {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,4 +2,5 @@ import QtQuick 2.12
|
|||||||
import QtQuick.Controls 2.5
|
import QtQuick.Controls 2.5
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ Flex {
|
|||||||
flexDirection: "column"
|
flexDirection: "column"
|
||||||
justifyContent: "flexStart"
|
justifyContent: "flexStart"
|
||||||
alignItems: "flexStart"
|
alignItems: "flexStart"
|
||||||
alignContent: "stretch"
|
alignContent: "flexStart"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ QQuickItem *DoricTextNode::build() {
|
|||||||
|
|
||||||
void DoricTextNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
void DoricTextNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||||
if (name == "text") {
|
if (name == "text") {
|
||||||
view->setProperty("text", prop.toString());
|
view->childItems().at(0)->setProperty("text", prop.toString());
|
||||||
} else {
|
} else {
|
||||||
DoricViewNode::blend(view, name, prop);
|
DoricViewNode::blend(view, name, prop);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,22 @@ void DoricViewNode::blendLayoutConfig(QJSValue jsObject) {
|
|||||||
qCritical() << 1;
|
qCritical() << 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
qCritical() << 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qCritical() << "default";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (heightSpec.isNumber()) {
|
||||||
|
switch (heightSpec.toInt()) {
|
||||||
|
case 1:
|
||||||
qCritical() << 1;
|
qCritical() << 1;
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
qCritical() << 2;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qCritical() << "default";
|
qCritical() << "default";
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user