diff --git a/src/plugins/screenshot/screenshotdbusinterface2.cpp b/src/plugins/screenshot/screenshotdbusinterface2.cpp index 9d8a28645e..9a677af927 100644 --- a/src/plugins/screenshot/screenshotdbusinterface2.cpp +++ b/src/plugins/screenshot/screenshotdbusinterface2.cpp @@ -151,8 +151,6 @@ class ScreenShotSource2 : public QObject public: explicit ScreenShotSource2(const QFuture &future); - bool isCancelled() const; - bool isCompleted() const; void marshal(ScreenShotSinkPipe2 *sink); virtual QVariantMap attributes() const; @@ -219,21 +217,16 @@ ScreenShotSource2::ScreenShotSource2(const QFuture &future) : m_future(future) { m_watcher = new QFutureWatcher(this); - connect(m_watcher, &QFutureWatcher::finished, this, &ScreenShotSource2::completed); - connect(m_watcher, &QFutureWatcher::canceled, this, &ScreenShotSource2::cancelled); + connect(m_watcher, &QFutureWatcher::finished, this, [this]() { + if (!m_future.isValid()) { + Q_EMIT cancelled(); + } else { + Q_EMIT completed(); + } + }); m_watcher->setFuture(m_future); } -bool ScreenShotSource2::isCancelled() const -{ - return m_future.isCanceled(); -} - -bool ScreenShotSource2::isCompleted() const -{ - return m_future.isFinished(); -} - QVariantMap ScreenShotSource2::attributes() const { return QVariantMap();