add list & list item & demo
This commit is contained in:
22
doric-Qt/example/doric/shader/list/DoricListItemNode.cpp
Normal file
22
doric-Qt/example/doric/shader/list/DoricListItemNode.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "DoricListItemNode.h"
|
||||
|
||||
QQuickItem *DoricListItemNode::build() {
|
||||
QQmlComponent component(getContext()->getQmlEngine());
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/doric/qml/list-item.qml"));
|
||||
component.loadUrl(url);
|
||||
|
||||
if (component.isError()) {
|
||||
qCritical() << component.errorString();
|
||||
}
|
||||
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||
this->createLayouts(item);
|
||||
|
||||
getLayouts()->setLayoutType(DoricLayoutType::DoricStack);
|
||||
|
||||
item->setProperty("wrapper", QString::number((qint64)this));
|
||||
return item;
|
||||
}
|
||||
|
||||
void DoricListItemNode::apply() { getLayouts()->apply(); }
|
17
doric-Qt/example/doric/shader/list/DoricListItemNode.h
Normal file
17
doric-Qt/example/doric/shader/list/DoricListItemNode.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef DORICLISTITEMNODE_H
|
||||
#define DORICLISTITEMNODE_H
|
||||
|
||||
#include "DoricExport.h"
|
||||
|
||||
#include "shader/DoricStackNode.h"
|
||||
|
||||
class DORIC_EXPORT DoricListItemNode : public DoricStackNode {
|
||||
public:
|
||||
using DoricStackNode::DoricStackNode;
|
||||
|
||||
QQuickItem *build() override;
|
||||
|
||||
void apply();
|
||||
};
|
||||
|
||||
#endif // DORICLISTITEMNODE_H
|
26
doric-Qt/example/doric/shader/list/DoricListNode.cpp
Normal file
26
doric-Qt/example/doric/shader/list/DoricListNode.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "DoricListNode.h"
|
||||
|
||||
QQuickItem *DoricListNode::build() {
|
||||
QQmlComponent component(getContext()->getQmlEngine());
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/doric/qml/list.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;
|
||||
}
|
||||
|
||||
DoricViewNode *DoricListNode::getSubNodeById(QString id) {}
|
||||
|
||||
void DoricListNode::blendSubNode(QJsonValue subProperties) {}
|
||||
|
||||
void DoricListNode::blend(QQuickItem *view, QString name, QJsonValue prop) {}
|
||||
|
||||
void DoricListNode::afterBlended(QJsonValue prop) {}
|
36
doric-Qt/example/doric/shader/list/DoricListNode.h
Normal file
36
doric-Qt/example/doric/shader/list/DoricListNode.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef DORICLISTNODE_H
|
||||
#define DORICLISTNODE_H
|
||||
|
||||
#include "DoricExport.h"
|
||||
|
||||
#include "DoricListItemNode.h"
|
||||
#include "shader/DoricSuperNode.h"
|
||||
|
||||
class DORIC_EXPORT DoricListNode : public DoricSuperNode {
|
||||
|
||||
private:
|
||||
QString renderItemFuncId;
|
||||
int itemCount = 0;
|
||||
int batchCount = 15;
|
||||
QString onLoadMoreFuncId;
|
||||
bool loadMore = false;
|
||||
QString loadMoreViewId;
|
||||
QString onScrollFuncId;
|
||||
QString onScrollEndFuncId;
|
||||
QList<DoricListItemNode *> childNodes;
|
||||
|
||||
public:
|
||||
using DoricSuperNode::DoricSuperNode;
|
||||
|
||||
QQuickItem *build() override;
|
||||
|
||||
virtual DoricViewNode *getSubNodeById(QString id) override;
|
||||
|
||||
virtual void blendSubNode(QJsonValue subProperties) override;
|
||||
|
||||
virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override;
|
||||
|
||||
virtual void afterBlended(QJsonValue prop) override;
|
||||
};
|
||||
|
||||
#endif // DORICLISTNODE_H
|
Reference in New Issue
Block a user