apply slide item

This commit is contained in:
王劲鹏 2021-05-31 19:28:45 +08:00 committed by osborn
parent 46e28577d9
commit 94045f11bf
7 changed files with 45 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "utils/DoricImageBridge.h"
#include "utils/DoricInputBridge.h"
#include "utils/DoricMouseAreaBridge.h"
#include "utils/DoricSlideItemBridge.h"
#include "utils/DoricSwitchBridge.h"
#include "utils/DoricUtils.h"
@ -120,4 +121,6 @@ void DoricDemoBridge::navigate(QVariant route) {
context->setContextProperty("inputBridge", inputBridge);
DoricSwitchBridge *switchBridge = new DoricSwitchBridge();
context->setContextProperty("switchBridge", switchBridge);
DoricSlideItemBridge *slideItemBridge = new DoricSlideItemBridge();
context->setContextProperty("slideItemBridge", slideItemBridge);
}

View File

@ -62,6 +62,7 @@ SOURCES += \
utils/DoricInputBridge.cpp \
utils/DoricLayouts.cpp \
utils/DoricMouseAreaBridge.cpp \
utils/DoricSlideItemBridge.cpp \
utils/DoricSwitchBridge.cpp \
widget/flex/FlexLayout.cpp \
widget/flex/FlexLayoutConfig.cpp \
@ -147,6 +148,7 @@ HEADERS += \
utils/DoricMouseAreaBridge.h \
utils/DoricNetworkService.h \
utils/DoricObjectFactory.h \
utils/DoricSlideItemBridge.h \
utils/DoricSwitchBridge.h \
utils/DoricThreadMode.h \
utils/DoricUtils.h \

View File

@ -19,12 +19,16 @@ Rectangle {
console.log(tag, uuid + " onWidthChanged: " + this.width)
updateGradient()
slideItemBridge.apply(wrapper)
}
onHeightChanged: {
console.log(tag, uuid + " onHeightChanged: " + this.height)
updateGradient()
slideItemBridge.apply(wrapper)
}
color: 'transparent'

View File

@ -18,3 +18,5 @@ QQuickItem *DoricSlideItemNode::build() {
item->setProperty("wrapper", QString::number((qint64)this));
return item;
}
void DoricSlideItemNode::apply() { getLayouts()->apply(); }

View File

@ -10,6 +10,8 @@ public:
using DoricStackNode::DoricStackNode;
QQuickItem *build() override;
void apply();
};
#endif // DORICSLIDEITEMNODE_H

View File

@ -0,0 +1,13 @@
#include "DoricSlideItemBridge.h"
#include "shader/slider/DoricSlideItemNode.h"
DoricSlideItemBridge::DoricSlideItemBridge(QObject *parent) : QObject(parent) {}
void DoricSlideItemBridge::apply(QString pointer) {
QObject *object = (QObject *)(pointer.toULongLong());
DoricSlideItemNode *slideItemNode =
dynamic_cast<DoricSlideItemNode *>(object);
slideItemNode->apply();
}

View File

@ -0,0 +1,19 @@
#ifndef DORICSLIDEITEMBRIDGE_H
#define DORICSLIDEITEMBRIDGE_H
#include <QObject>
#include <QVariant>
#include "DoricExport.h"
class DORIC_EXPORT DoricSlideItemBridge : public QObject {
Q_OBJECT
public:
explicit DoricSlideItemBridge(QObject *parent = nullptr);
Q_INVOKABLE
void apply(QString pointer);
signals:
};
#endif // DORICSLIDEITEMBRIDGE_H