add list bind function
This commit is contained in:
9
doric-Qt/example/doric/shader/list/DoricListAdapter.cpp
Normal file
9
doric-Qt/example/doric/shader/list/DoricListAdapter.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "DoricListAdapter.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
DoricListAdapter::DoricListAdapter() {}
|
||||
|
||||
void DoricListAdapter::bind(QVariant rectangle, int position) {
|
||||
qDebug() << "==========" << rectangle << " " << position;
|
||||
}
|
13
doric-Qt/example/doric/shader/list/DoricListAdapter.h
Normal file
13
doric-Qt/example/doric/shader/list/DoricListAdapter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef DORICLISTADAPTER_H
|
||||
#define DORICLISTADAPTER_H
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
class DoricListAdapter {
|
||||
public:
|
||||
DoricListAdapter();
|
||||
|
||||
void bind(QVariant rectangle, int position);
|
||||
};
|
||||
|
||||
#endif // DORICLISTADAPTER_H
|
@@ -21,6 +21,19 @@ DoricViewNode *DoricListNode::getSubNodeById(QString id) {}
|
||||
|
||||
void DoricListNode::blendSubNode(QJsonValue subProperties) {}
|
||||
|
||||
void DoricListNode::blend(QQuickItem *view, QString name, QJsonValue prop) {}
|
||||
void DoricListNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
|
||||
if (name == "itemCount") {
|
||||
this->itemCount = prop.toInt();
|
||||
} else {
|
||||
DoricSuperNode::blend(view, name, prop);
|
||||
}
|
||||
}
|
||||
|
||||
void DoricListNode::afterBlended(QJsonValue prop) {}
|
||||
void DoricListNode::afterBlended(QJsonValue prop) {
|
||||
mView->setProperty("model", this->itemCount);
|
||||
}
|
||||
|
||||
// adapter method
|
||||
void DoricListNode::bind(QVariant rectangle, int position) {
|
||||
listAdapter.bind(rectangle, position);
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "DoricListItemNode.h"
|
||||
#include "shader/DoricSuperNode.h"
|
||||
#include "DoricListAdapter.h"
|
||||
|
||||
class DORIC_EXPORT DoricListNode : public DoricSuperNode {
|
||||
|
||||
@@ -17,7 +18,7 @@ private:
|
||||
QString loadMoreViewId;
|
||||
QString onScrollFuncId;
|
||||
QString onScrollEndFuncId;
|
||||
QList<DoricListItemNode *> childNodes;
|
||||
DoricListAdapter listAdapter;
|
||||
|
||||
public:
|
||||
using DoricSuperNode::DoricSuperNode;
|
||||
@@ -31,6 +32,8 @@ public:
|
||||
virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override;
|
||||
|
||||
virtual void afterBlended(QJsonValue prop) override;
|
||||
|
||||
void bind(QVariant rectangle, int position);
|
||||
};
|
||||
|
||||
#endif // DORICLISTNODE_H
|
||||
|
Reference in New Issue
Block a user