add flex node & demo
This commit is contained in:
33
doric-Qt/example/doric/shader/DoricFlexNode.cpp
Normal file
33
doric-Qt/example/doric/shader/DoricFlexNode.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "DoricFlexNode.h"
|
||||
|
||||
QQuickItem *DoricFlexNode::build() {
|
||||
QQmlComponent component(getContext()->getQmlEngine());
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/doric/qml/flex.qml"));
|
||||
component.loadUrl(url);
|
||||
|
||||
if (component.isError()) {
|
||||
qCritical() << component.errorString();
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
this->createLayouts(item);
|
||||
|
||||
item->setProperty("wrapper", QString::number((qint64)this));
|
||||
return item;
|
||||
}
|
||||
|
||||
void DoricFlexNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
|
||||
if (name == "flexConfig") {
|
||||
|
||||
} else {
|
||||
DoricGroupNode::blend(view, name, prop);
|
||||
}
|
||||
}
|
||||
|
||||
void DoricFlexNode::blendSubNode(DoricViewNode *subNode,
|
||||
QJsonValue flexConfig) {}
|
||||
|
||||
void DoricFlexNode::blendYoga(YGLayout *yoga, QJsonValue flexConfig) {}
|
||||
|
||||
void DoricFlexNode::blendYoga(YGLayout *yoga, QString name, QJsonValue prop) {}
|
28
doric-Qt/example/doric/shader/DoricFlexNode.h
Normal file
28
doric-Qt/example/doric/shader/DoricFlexNode.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef DORICFLEXNODE_H
|
||||
#define DORICFLEXNODE_H
|
||||
|
||||
#include "DoricExport.h"
|
||||
|
||||
#include "shader/DoricStackNode.h"
|
||||
|
||||
#include "yoga/YGLayout.h"
|
||||
|
||||
class DORIC_EXPORT DoricFlexNode : public DoricGroupNode {
|
||||
|
||||
public:
|
||||
using DoricGroupNode::DoricGroupNode;
|
||||
|
||||
QQuickItem *build() override;
|
||||
|
||||
virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override;
|
||||
|
||||
virtual void blendSubNode(DoricViewNode *subNode,
|
||||
QJsonValue flexConfig) override;
|
||||
|
||||
private:
|
||||
void blendYoga(YGLayout *yoga, QJsonValue flexConfig);
|
||||
|
||||
void blendYoga(YGLayout *yoga, QString name, QJsonValue prop);
|
||||
};
|
||||
|
||||
#endif // DORICFLEXNODE_H
|
@@ -18,6 +18,11 @@ void DoricSuperNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void DoricSuperNode::blendSubNode(DoricViewNode *subNode,
|
||||
QJsonValue layoutConfig) {
|
||||
subNode->blendLayoutConfig(layoutConfig);
|
||||
}
|
||||
|
||||
void DoricSuperNode::mixinSubNode(QJsonValue subNode) {
|
||||
QString id = subNode["id"].toString();
|
||||
QList<QString> keys = subNodes.keys();
|
||||
|
@@ -16,6 +16,8 @@ protected:
|
||||
|
||||
virtual void blendSubNode(QJsonValue subProperties) = 0;
|
||||
|
||||
virtual void blendSubNode(DoricViewNode *subNode, QJsonValue layoutConfig);
|
||||
|
||||
void recursiveMixin(QJsonValue src, QJsonValue target);
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user