add slider, slider node & pure call response
This commit is contained in:
@@ -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;
|
||||
|
@@ -78,5 +78,7 @@ public:
|
||||
void onClick();
|
||||
|
||||
void callJSResponse(QString funcId, QVariantList args);
|
||||
|
||||
void pureCallJSResponse(QString funcId, QVariantList args);
|
||||
};
|
||||
#endif // DORICVIEWNODE_H
|
||||
|
@@ -0,0 +1 @@
|
||||
#include "DoricSlideItemNode.h"
|
11
doric-Qt/example/doric/shader/slider/DoricSlideItemNode.h
Normal file
11
doric-Qt/example/doric/shader/slider/DoricSlideItemNode.h
Normal 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
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user