add slider, slider node & pure call response

This commit is contained in:
王劲鹏
2021-05-10 16:09:29 +08:00
committed by osborn
parent 3721c856fb
commit 3531a28f13
10 changed files with 56 additions and 0 deletions

View File

@@ -219,6 +219,20 @@ void DoricViewNode::callJSResponse(QString funcId, QVariantList args) {
return getContext()->callEntity(DoricConstant::DORIC_ENTITY_RESPONSE, nArgs);
}
void DoricViewNode::pureCallJSResponse(QString funcId, QVariantList args) {
QVariantList nArgs;
nArgs.append(getContext()->getContextId());
nArgs.append(DoricConstant::DORIC_ENTITY_RESPONSE);
QList<QString> idList = getIdList();
nArgs.append(QVariant(idList));
nArgs.append(funcId);
foreach (const QVariant &arg, args)
nArgs.append(arg);
return getContext()->callEntity(DoricConstant::DORIC_CONTEXT_INVOKE_PURE,
nArgs);
}
void DoricViewNode::onClick() {
if (clickFunction.isEmpty()) {
return;

View File

@@ -78,5 +78,7 @@ public:
void onClick();
void callJSResponse(QString funcId, QVariantList args);
void pureCallJSResponse(QString funcId, QVariantList args);
};
#endif // DORICVIEWNODE_H

View File

@@ -0,0 +1 @@
#include "DoricSlideItemNode.h"

View File

@@ -0,0 +1,11 @@
#ifndef DORICSLIDEITEMNODE_H
#define DORICSLIDEITEMNODE_H
#include "shader/DoricStackNode.h"
class DoricSlideItemNode : public DoricStackNode {
public:
using DoricStackNode::DoricStackNode;
};
#endif // DORICSLIDEITEMNODE_H

View File

@@ -35,3 +35,12 @@ void DoricSliderNode::blendSubNode(QJsonValue subProperties) {
void DoricSliderNode::blend(QJsonValue jsValue) {}
void DoricSliderNode::blend(QQuickItem *view, QString name, QJsonValue prop) {}
void DoricSliderNode::afterBlended(QJsonValue prop) {
if (this->childNodes.length() != this->itemCount) {
QVariantList args;
args.append(this->childNodes.length());
args.append(this->itemCount);
this->pureCallJSResponse("renderBunchedItems", args);
}
}

View File

@@ -1,10 +1,19 @@
#ifndef DORICSLIDERNODE_H
#define DORICSLIDERNODE_H
#include "DoricSlideItemNode.h"
#include "shader/DoricSuperNode.h"
class DoricSliderNode : public DoricSuperNode {
private:
int itemCount = 0;
QString renderPageFuncId;
int batchCount = 15;
QString onPageSelectedFuncId;
bool loop = false;
QList<DoricSlideItemNode *> childNodes;
public:
using DoricSuperNode::DoricSuperNode;
@@ -17,6 +26,8 @@ public:
virtual void blend(QJsonValue jsValue) override;
virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override;
virtual void afterBlended(QJsonValue prop) override;
};
#endif // DORICSLIDERNODE_H