add quick item to quick view dynamically
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
QQuickItem *DoricStackNode::build() {
|
||||
QQmlComponent component;
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/stack.qml"));
|
||||
const QUrl url(QStringLiteral("qrc:/doric/qml/stack.qml"));
|
||||
component.loadUrl(url);
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
|
@@ -3,14 +3,13 @@
|
||||
|
||||
#include "DoricGroupNode.h"
|
||||
|
||||
class DoricStackNode : public DoricGroupNode
|
||||
{
|
||||
class DoricStackNode : public DoricGroupNode {
|
||||
public:
|
||||
using DoricGroupNode::DoricGroupNode;
|
||||
using DoricGroupNode::DoricGroupNode;
|
||||
|
||||
QQuickItem *build() override;
|
||||
QQuickItem *build() override;
|
||||
|
||||
void blendLayoutConfig() override;
|
||||
void blendLayoutConfig() override;
|
||||
};
|
||||
|
||||
#endif // DORICSTACKNODE_H
|
||||
|
@@ -4,11 +4,14 @@
|
||||
#include "DoricViewNode.h"
|
||||
|
||||
class DoricSuperNode : public DoricViewNode {
|
||||
|
||||
protected:
|
||||
void blendSubLayoutConfig(DoricViewNode *viewNode);
|
||||
|
||||
public:
|
||||
using DoricViewNode::DoricViewNode;
|
||||
|
||||
bool mReusable = false;
|
||||
};
|
||||
|
||||
#endif // DORICSUPERNODE_H
|
||||
|
@@ -1,5 +1,22 @@
|
||||
#include "DoricViewNode.h"
|
||||
#include "../utils/DoricUtils.h"
|
||||
#include "DoricSuperNode.h"
|
||||
|
||||
void DoricViewNode::blendLayoutConfig(){
|
||||
void DoricViewNode::blendLayoutConfig() {}
|
||||
|
||||
void DoricViewNode::setLayoutConfig(QJSValue layoutConfig) {}
|
||||
|
||||
void DoricViewNode::init(DoricSuperNode *superNode) {
|
||||
if (DoricUtils:: instanceof <DoricSuperNode *>(this)) {
|
||||
DoricSuperNode *thiz = dynamic_cast<DoricSuperNode *>(this);
|
||||
thiz->mReusable = superNode->mReusable;
|
||||
}
|
||||
this->mSuperNode = superNode;
|
||||
this->mView = build();
|
||||
}
|
||||
|
||||
QString DoricViewNode::getId() { return mId; }
|
||||
|
||||
void DoricViewNode::setId(QString id) { mId = id; }
|
||||
|
||||
void DoricViewNode::blend(QJSValue jsValue) { qDebug() << jsValue.toString(); }
|
||||
|
@@ -5,20 +5,34 @@
|
||||
|
||||
#include "../utils/DoricContextHolder.h"
|
||||
|
||||
class DoricSuperNode;
|
||||
|
||||
class DoricViewNode : public DoricContextHolder {
|
||||
|
||||
protected:
|
||||
QQuickItem *mView;
|
||||
|
||||
DoricSuperNode *mSuperNode;
|
||||
|
||||
virtual QQuickItem *build() = 0;
|
||||
|
||||
virtual void blendLayoutConfig();
|
||||
|
||||
void setLayoutConfig(QJSValue layoutConfig);
|
||||
|
||||
private:
|
||||
QString mId;
|
||||
QString mType;
|
||||
|
||||
public:
|
||||
using DoricContextHolder::DoricContextHolder;
|
||||
|
||||
void init(DoricSuperNode *superNode);
|
||||
|
||||
QString getId();
|
||||
|
||||
void setId(QString id);
|
||||
|
||||
void blend(QJSValue jsValue);
|
||||
};
|
||||
#endif // DORICVIEWNODE_H
|
||||
|
Reference in New Issue
Block a user