handle response
This commit is contained in:
@@ -20,8 +20,17 @@ QQuickItem *DoricDraggableNode::build() {
|
||||
void DoricDraggableNode::blend(QQuickItem *view, QString name,
|
||||
QJsonValue prop) {
|
||||
if (name == "onDrag") {
|
||||
onDrag = prop.toString();
|
||||
onDragFunction = prop.toString();
|
||||
} else {
|
||||
DoricStackNode::blend(view, name, prop);
|
||||
}
|
||||
}
|
||||
|
||||
void DoricDraggableNode::onDrag(double x, double y) {
|
||||
getLayouts()->setMarginLeft(x);
|
||||
getLayouts()->setMarginTop(y);
|
||||
QVariantList args;
|
||||
args.append(x);
|
||||
args.append(y);
|
||||
callJSResponse(onDragFunction, args);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
class DORIC_EXPORT DoricDraggableNode : public DoricStackNode {
|
||||
|
||||
private:
|
||||
QString onDrag;
|
||||
QString onDragFunction;
|
||||
|
||||
public:
|
||||
using DoricStackNode::DoricStackNode;
|
||||
@@ -16,6 +16,8 @@ public:
|
||||
QQuickItem *build() override;
|
||||
|
||||
virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override;
|
||||
|
||||
void onDrag(double x, double y);
|
||||
};
|
||||
|
||||
#endif // DORICDRAGGABLENODE_H
|
||||
|
Reference in New Issue
Block a user