add confirm
This commit is contained in:
36
doric-Qt/doric/utils/DoricDialogBridge.cpp
Normal file
36
doric-Qt/doric/utils/DoricDialogBridge.cpp
Normal 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);
|
||||
}
|
||||
}
|
20
doric-Qt/doric/utils/DoricDialogBridge.h
Normal file
20
doric-Qt/doric/utils/DoricDialogBridge.h
Normal 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
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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
|
Reference in New Issue
Block a user