add confirm

This commit is contained in:
王劲鹏
2021-04-22 13:42:38 +08:00
committed by osborn
parent dda16db50a
commit d47fa2bb7d
12 changed files with 191 additions and 47 deletions

View File

@@ -0,0 +1,36 @@
#include "DoricDialogBridge.h"
#include "plugin/DoricModalPlugin.h"
#include <QQuickWindow>
DoricDialogBridge::DoricDialogBridge(QObject *parent) : QObject(parent) {}
void DoricDialogBridge::onAccepted(QString windowPointer, QString pluginPointer,
QString callbackId) {
{
QObject *object = (QObject *)(windowPointer.toULongLong());
QQuickWindow *window = dynamic_cast<QQuickWindow *>(object);
window->deleteLater();
}
{
QObject *object = (QObject *)(pluginPointer.toULongLong());
DoricModalPlugin *modalPlugin = dynamic_cast<DoricModalPlugin *>(object);
modalPlugin->onAccepted(callbackId);
}
}
void DoricDialogBridge::onRejected(QString windowPointer, QString pluginPointer,
QString callbackId) {
{
QObject *object = (QObject *)(windowPointer.toULongLong());
QQuickWindow *window = dynamic_cast<QQuickWindow *>(object);
window->deleteLater();
}
{
QObject *object = (QObject *)(pluginPointer.toULongLong());
DoricModalPlugin *modalPlugin = dynamic_cast<DoricModalPlugin *>(object);
modalPlugin->onRejected(callbackId);
}
}

View File

@@ -0,0 +1,20 @@
#ifndef DORICDIALOGBRIDGE_H
#define DORICDIALOGBRIDGE_H
#include <QObject>
class DoricDialogBridge : public QObject {
Q_OBJECT
public:
explicit DoricDialogBridge(QObject *parent = nullptr);
Q_INVOKABLE
void onAccepted(QString windowPointer, QString pluginPointer,
QString callbackId);
Q_INVOKABLE
void onRejected(QString windowPointer, QString pluginPointer,
QString callbackId);
};
#endif // DORICDIALOGBRIDGE_H

View File

@@ -1,23 +0,0 @@
#include "DoricDialogOnAcceptedBridge.h"
#include "plugin/DoricModalPlugin.h"
#include <QQuickWindow>
DoricDialogOnAcceptedBridge::DoricDialogOnAcceptedBridge(QObject *parent)
: QObject(parent) {}
void DoricDialogOnAcceptedBridge::onClick(QString windowPointer,
QString pluginPointer,
QString callbackId) {
{
QObject *object = (QObject *)(windowPointer.toULongLong());
QQuickWindow *window = dynamic_cast<QQuickWindow *>(object);
window->deleteLater();
}
{
QObject *object = (QObject *)(pluginPointer.toULongLong());
DoricModalPlugin *modalPlugin = dynamic_cast<DoricModalPlugin *>(object);
modalPlugin->onAccept(callbackId);
}
}

View File

@@ -1,16 +0,0 @@
#ifndef DORICDIALOGONACCEPTEDBRIDGE_H
#define DORICDIALOGONACCEPTEDBRIDGE_H
#include <QObject>
class DoricDialogOnAcceptedBridge : public QObject {
Q_OBJECT
public:
explicit DoricDialogOnAcceptedBridge(QObject *parent = nullptr);
Q_INVOKABLE
void onClick(QString windowPointer, QString pluginPointer,
QString callbackId);
};
#endif // DORICDIALOGONACCEPTEDBRIDGE_H