add text node
This commit is contained in:
parent
46ecc85ece
commit
fc0df69ed4
@ -1,10 +1,11 @@
|
||||
#include "DoricRegistry.h"
|
||||
|
||||
#include "plugin/DoricShaderPlugin.h"
|
||||
#include "shader/DoricHLayoutNode.h"
|
||||
#include "shader/DoricRootNode.h"
|
||||
#include "shader/DoricStackNode.h"
|
||||
#include "shader/DoricTextNode.h"
|
||||
#include "shader/DoricVLayoutNode.h"
|
||||
#include "shader/DoricHLayoutNode.h"
|
||||
|
||||
DoricRegistry::DoricRegistry() {
|
||||
registerNativePlugin<DoricShaderPlugin>("shader");
|
||||
@ -13,6 +14,7 @@ DoricRegistry::DoricRegistry() {
|
||||
registerViewNode<DoricStackNode>("Stack");
|
||||
registerViewNode<DoricVLayoutNode>("VLayout");
|
||||
registerViewNode<DoricHLayoutNode>("HLayout");
|
||||
registerViewNode<DoricTextNode>("Text");
|
||||
}
|
||||
|
||||
bool DoricRegistry::acquirePluginInfo(QString name) {
|
||||
|
@ -37,6 +37,7 @@ SOURCES += \
|
||||
shader/DoricRootNode.cpp \
|
||||
shader/DoricStackNode.cpp \
|
||||
shader/DoricSuperNode.cpp \
|
||||
shader/DoricTextNode.cpp \
|
||||
shader/DoricVLayoutNode.cpp \
|
||||
shader/DoricViewNode.cpp \
|
||||
utils/DoricConstant.cpp \
|
||||
@ -83,6 +84,7 @@ HEADERS += \
|
||||
shader/DoricRootNode.h \
|
||||
shader/DoricStackNode.h \
|
||||
shader/DoricSuperNode.h \
|
||||
shader/DoricTextNode.h \
|
||||
shader/DoricVLayoutNode.h \
|
||||
shader/DoricViewNode.h \
|
||||
template/DoricSingleton.h \
|
||||
|
@ -19,5 +19,6 @@
|
||||
<file alias="stack.qml">./resources/stack.qml</file>
|
||||
<file alias="vlayout.qml">./resources/vlayout.qml</file>
|
||||
<file alias="hlayout.qml">./resources/hlayout.qml</file>
|
||||
<file alias="text.qml">./resources/text.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
6
doric-Qt/doric/resources/text.qml
Normal file
6
doric-Qt/doric/resources/text.qml
Normal file
@ -0,0 +1,6 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
Text {
|
||||
|
||||
}
|
23
doric-Qt/doric/shader/DoricTextNode.cpp
Normal file
23
doric-Qt/doric/shader/DoricTextNode.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "DoricTextNode.h"
|
||||
|
||||
QQuickItem *DoricTextNode::build() {
|
||||
QQmlComponent component(getContext()->getQmlEngine());
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/doric/qml/text.qml"));
|
||||
component.loadUrl(url);
|
||||
|
||||
if (component.isError()) {
|
||||
qCritical() << component.errorString();
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
return item;
|
||||
}
|
||||
|
||||
void DoricTextNode::blend(QQuickItem *view, QString name, QJSValue prop) {
|
||||
if (name == "text") {
|
||||
view->setProperty("text", prop.toString());
|
||||
} else {
|
||||
DoricViewNode::blend(view, name, prop);
|
||||
}
|
||||
}
|
15
doric-Qt/doric/shader/DoricTextNode.h
Normal file
15
doric-Qt/doric/shader/DoricTextNode.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef DORICTEXTNODE_H
|
||||
#define DORICTEXTNODE_H
|
||||
|
||||
#include "DoricViewNode.h"
|
||||
|
||||
class DoricTextNode : public DoricViewNode {
|
||||
public:
|
||||
using DoricViewNode::DoricViewNode;
|
||||
|
||||
QQuickItem *build() override;
|
||||
|
||||
virtual void blend(QQuickItem *view, QString name, QJSValue prop) override;
|
||||
};
|
||||
|
||||
#endif // DORICTEXTNODE_H
|
Reference in New Issue
Block a user