trunked to a lambda for simplicity

This commit is contained in:
amer cerkic 2019-07-26 13:52:38 -07:00
parent 087b19d64d
commit de0b038ee1
2 changed files with 5 additions and 11 deletions

View file

@ -136,8 +136,10 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
if (properties.contains(PRESENTATION_MODE_PROPERTY)) {
presentationMode = (InteractiveWindowPresentationMode) properties[PRESENTATION_MODE_PROPERTY].toInt();
}
_interactiveWindowProxy = std::unique_ptr<InteractiveWindowProxy, InteractiveWindowProxyDeleter>(new InteractiveWindowProxy());
_interactiveWindowProxy= std::unique_ptr<InteractiveWindowProxy, std::function<void(InteractiveWindowProxy*)>>(new InteractiveWindowProxy, [](InteractiveWindowProxy *p) {
p->deleteLater();
});
QObject::connect(_interactiveWindowProxy.get(), &InteractiveWindowProxy::webEventReceived, this, &InteractiveWindow::emitWebEvent, Qt::QueuedConnection);
QObject::connect(this, &InteractiveWindow::scriptEventReceived, _interactiveWindowProxy.get(), &InteractiveWindowProxy::emitScriptEvent, Qt::QueuedConnection);

View file

@ -37,7 +37,6 @@ private:
};
class InteractiveWindowProxy : public QObject {
Q_OBJECT
public:
@ -54,13 +53,6 @@ signals:
void webEventReceived(const QVariant& message);
};
struct InteractiveWindowProxyDeleter {
void operator()(InteractiveWindowProxy * p) {
p->deleteLater();
}
};
namespace InteractiveWindowEnums {
Q_NAMESPACE
@ -332,7 +324,7 @@ protected slots:
private:
std::shared_ptr<QmlWindowProxy> _qmlWindowProxy;
std::shared_ptr<DockWidget> _dockWidget { nullptr };
std::unique_ptr<InteractiveWindowProxy, InteractiveWindowProxyDeleter> _interactiveWindowProxy;
std::unique_ptr<InteractiveWindowProxy, std::function<void(InteractiveWindowProxy*)>> _interactiveWindowProxy;
};
typedef InteractiveWindow* InteractiveWindowPointer;