summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectnode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/remoteobjects/qremoteobjectnode.cpp')
-rw-r--r--src/remoteobjects/qremoteobjectnode.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/remoteobjects/qremoteobjectnode.cpp b/src/remoteobjects/qremoteobjectnode.cpp
index 3d9a2fc..4b883dc 100644
--- a/src/remoteobjects/qremoteobjectnode.cpp
+++ b/src/remoteobjects/qremoteobjectnode.cpp
@@ -2110,6 +2110,10 @@ bool QRemoteObjectNode::connectToNode(const QUrl &address)
void QRemoteObjectNode::addClientSideConnection(QIODevice *ioDevice)
{
Q_D(QRemoteObjectNode);
+ if (!ioDevice || !ioDevice->isOpen()) {
+ qWarning() << "A null or closed QIODevice was passed to addClientSideConnection(). Ignoring.";
+ return;
+ }
ExternalIoDevice *device = new ExternalIoDevice(ioDevice, this);
connect(device, &IoDeviceBase::readyRead, this, [d, device]() {
d->onClientRead(device);
@@ -2390,6 +2394,10 @@ bool QRemoteObjectHostBase::disableRemoting(QObject *remoteObject)
void QRemoteObjectHostBase::addHostSideConnection(QIODevice *ioDevice)
{
Q_D(QRemoteObjectHostBase);
+ if (!ioDevice || !ioDevice->isOpen()) {
+ qWarning() << "A null or closed QIODevice was passed to addHostSideConnection(). Ignoring.";
+ return;
+ }
if (!d->remoteObjectIo)
d->remoteObjectIo = new QRemoteObjectSourceIo(this);
ExternalIoDevice *device = new ExternalIoDevice(ioDevice, this);
@@ -2397,12 +2405,17 @@ void QRemoteObjectHostBase::addHostSideConnection(QIODevice *ioDevice)
}
/*!
- Returns a pointer to a Replica which is specifically derived from \l
- QAbstractItemModel. The \a name provided must match the name used with the
- matching \l {QRemoteObjectHostBase::}{enableRemoting} that put
- the Model on the network. The returned model will be empty until it is
- initialized with the \l Source.
- */
+ Returns a pointer to a \l Replica which is specifically derived from \l
+ QAbstractItemModel. The \a name provided must match the name used with the
+ matching \l {QRemoteObjectHostBase::}{enableRemoting} that put
+ the \l Model on the network. \a action specifies whether the model should
+ fetch data before the \l {QRemoteObjectReplica::}{initialized} signal is
+ emitted. If it's set to QtRemoteObjects::PrefetchData, then the data for
+ roles in the \a rolesHint will be prefetched. If \a rolesHint is empty, then
+ the data for all the roles exposed by \l Source will be prefetched.
+
+ The returned model will be empty until it is initialized with the \l Source.
+*/
QAbstractItemModelReplica *QRemoteObjectNode::acquireModel(const QString &name, QtRemoteObjects::InitialAction action, const QVector<int> &rolesHint)
{
QAbstractItemModelReplicaImplementation *rep = acquire<QAbstractItemModelReplicaImplementation>(name);