From 738566e043b0d9713db62d9c3ecd77d9c305bb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Fri, 11 Jun 2021 17:59:29 +0800 Subject: [PATCH] add list bridge --- doric-Qt/example/app/demo/DoricDemoBridge.cpp | 3 +++ doric-Qt/example/doric/doric.pro | 2 ++ doric-Qt/example/doric/resources/list.qml | 5 +++++ doric-Qt/example/doric/utils/DoricListBridge.cpp | 3 +++ doric-Qt/example/doric/utils/DoricListBridge.h | 15 +++++++++++++++ 5 files changed, 28 insertions(+) create mode 100644 doric-Qt/example/doric/utils/DoricListBridge.cpp create mode 100644 doric-Qt/example/doric/utils/DoricListBridge.h diff --git a/doric-Qt/example/app/demo/DoricDemoBridge.cpp b/doric-Qt/example/app/demo/DoricDemoBridge.cpp index 9e93cb5a..c5c19074 100644 --- a/doric-Qt/example/app/demo/DoricDemoBridge.cpp +++ b/doric-Qt/example/app/demo/DoricDemoBridge.cpp @@ -8,6 +8,7 @@ #include "utils/DoricDraggableBridge.h" #include "utils/DoricImageBridge.h" #include "utils/DoricInputBridge.h" +#include "utils/DoricListBridge.h" #include "utils/DoricMouseAreaBridge.h" #include "utils/DoricSlideItemBridge.h" #include "utils/DoricSliderBridge.h" @@ -35,6 +36,8 @@ DoricDemoBridge::DoricDemoBridge(QQmlApplicationEngine *engine, QObject *parent) context->setContextProperty("sliderBridge", sliderBridge); DoricDraggableBridge *draggableBridge = new DoricDraggableBridge(); context->setContextProperty("draggableBridge", draggableBridge); + DoricListBridge *listBridge = new DoricListBridge(); + context->setContextProperty("listBridge", listBridge); } void DoricDemoBridge::navigate(QVariant source, QVariant alias) { diff --git a/doric-Qt/example/doric/doric.pro b/doric-Qt/example/doric/doric.pro index 4b0cb976..fb6c4e2c 100644 --- a/doric-Qt/example/doric/doric.pro +++ b/doric-Qt/example/doric/doric.pro @@ -72,6 +72,7 @@ SOURCES += \ utils/DoricImageBridge.cpp \ utils/DoricInputBridge.cpp \ utils/DoricLayouts.cpp \ + utils/DoricListBridge.cpp \ utils/DoricMouseAreaBridge.cpp \ utils/DoricSlideItemBridge.cpp \ utils/DoricSliderBridge.cpp \ @@ -169,6 +170,7 @@ HEADERS += \ utils/DoricImageBridge.h \ utils/DoricInputBridge.h \ utils/DoricLayouts.h \ + utils/DoricListBridge.h \ utils/DoricMouseAreaBridge.h \ utils/DoricNetworkService.h \ utils/DoricObjectFactory.h \ diff --git a/doric-Qt/example/doric/resources/list.qml b/doric-Qt/example/doric/resources/list.qml index dea66b71..acf7d963 100644 --- a/doric-Qt/example/doric/resources/list.qml +++ b/doric-Qt/example/doric/resources/list.qml @@ -45,4 +45,9 @@ ListView { console.log(tag, uuid + " onCurrentIndexChanged: " + this.currentIndex) } + delegate: Rectangle { + Component.onCompleted: { +// listBridge.getItemModel(index) + } + } } diff --git a/doric-Qt/example/doric/utils/DoricListBridge.cpp b/doric-Qt/example/doric/utils/DoricListBridge.cpp new file mode 100644 index 00000000..55cb73f3 --- /dev/null +++ b/doric-Qt/example/doric/utils/DoricListBridge.cpp @@ -0,0 +1,3 @@ +#include "DoricListBridge.h" + +DoricListBridge::DoricListBridge(QObject *parent) : QObject(parent) {} diff --git a/doric-Qt/example/doric/utils/DoricListBridge.h b/doric-Qt/example/doric/utils/DoricListBridge.h new file mode 100644 index 00000000..85e81cd4 --- /dev/null +++ b/doric-Qt/example/doric/utils/DoricListBridge.h @@ -0,0 +1,15 @@ +#ifndef DORICLISTBRIDGE_H +#define DORICLISTBRIDGE_H + +#include +#include + +#include "DoricExport.h" + +class DORIC_EXPORT DoricListBridge : public QObject { + Q_OBJECT +public: + explicit DoricListBridge(QObject *parent = nullptr); +}; + +#endif // DORICLISTBRIDGE_H