summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutureinterface.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-07-13 10:18:46 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-07-13 17:46:05 +0200
commit3fb0208d4b164f10131aeb48774a099cae4f8415 (patch)
tree18e5b4cb48703252676dacf31938f0afca944776 /src/corelib/thread/qfutureinterface.cpp
parent56a776da406c710de3dbf8832b7c20add2e4ca3a (diff)
QBasicFutureWatcher: get rid of the Private
It's not needed anymore, because the class is no longer part of the ABI. Pick-to: 6.6 Change-Id: Idfacc6023288ce603b30ab5aa904106e8c850444 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/thread/qfutureinterface.cpp')
-rw-r--r--src/corelib/thread/qfutureinterface.cpp35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index d8aeb76951c..6184d9133a0 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -45,11 +45,9 @@ const auto suspendingOrSuspended =
} // unnamed namespace
-class QBasicFutureWatcherPrivate;
-class QBasicFutureWatcher : public QObject
+class QBasicFutureWatcher : public QObject, QFutureCallOutInterface
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QBasicFutureWatcher)
public:
explicit QBasicFutureWatcher(QObject *parent = nullptr);
~QBasicFutureWatcher() override;
@@ -60,56 +58,47 @@ public:
Q_SIGNALS:
void finished();
-};
-
-class QBasicFutureWatcherPrivate : public QObjectPrivate, QFutureCallOutInterface
-{
-public:
- Q_DECLARE_PUBLIC(QBasicFutureWatcher)
+private:
QFutureInterfaceBase future;
void postCallOutEvent(const QFutureCallOutEvent &event) override;
void callOutInterfaceDisconnected() override;
};
-void QBasicFutureWatcherPrivate::postCallOutEvent(const QFutureCallOutEvent &event)
+void QBasicFutureWatcher::postCallOutEvent(const QFutureCallOutEvent &event)
{
- Q_Q(QBasicFutureWatcher);
- if (q->thread() == QThread::currentThread()) {
+ if (thread() == QThread::currentThread()) {
// If we are in the same thread, don't queue up anything.
std::unique_ptr<QFutureCallOutEvent> clonedEvent(event.clone());
- QCoreApplication::sendEvent(q, clonedEvent.get());
+ QCoreApplication::sendEvent(this, clonedEvent.get());
} else {
- QCoreApplication::postEvent(q, event.clone());
+ QCoreApplication::postEvent(this, event.clone());
}
}
-void QBasicFutureWatcherPrivate::callOutInterfaceDisconnected()
+void QBasicFutureWatcher::callOutInterfaceDisconnected()
{
- Q_Q(QBasicFutureWatcher);
- QCoreApplication::removePostedEvents(q, QEvent::FutureCallOut);
+ QCoreApplication::removePostedEvents(this, QEvent::FutureCallOut);
}
/*
* QBasicFutureWatcher is a more lightweight version of QFutureWatcher for internal use
*/
QBasicFutureWatcher::QBasicFutureWatcher(QObject *parent)
- : QObject(*new QBasicFutureWatcherPrivate, parent)
+ : QObject(parent)
{
}
QBasicFutureWatcher::~QBasicFutureWatcher()
{
- Q_D(QBasicFutureWatcher);
- d->future.d->disconnectOutputInterface(d);
+ future.d->disconnectOutputInterface(this);
}
void QBasicFutureWatcher::setFuture(QFutureInterfaceBase &fi)
{
- Q_D(QBasicFutureWatcher);
- d->future = fi;
- d->future.d->connectOutputInterface(d);
+ future = fi;
+ future.d->connectOutputInterface(this);
}
bool QBasicFutureWatcher::event(QEvent *event)