summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-05 09:19:34 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-05 09:19:34 +0100
commit243807c53d4920a69022cc8f7d11edf59602d0ba (patch)
treea5240b6845b48888aa677e2960bc98ec89f91a48
parent7844b91364665fa4c0592bd6fbe3ec8433dcbe9e (diff)
parente4631d1a6aa20dfdd32fff2e3764223435fe427f (diff)
Merge remote-tracking branch 'origin/5.12.0' into 5.12
-rw-r--r--dist/changes-5.12.046
-rw-r--r--examples/remoteobjects/ssl/sslcppclient/main.cpp3
-rw-r--r--src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp36
-rw-r--r--src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h2
-rw-r--r--src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp34
-rw-r--r--src/remoteobjects/qremoteobjectnode.cpp16
-rw-r--r--src/remoteobjects/qremoteobjectnode.h3
-rw-r--r--src/remoteobjects/qremoteobjectpacket.cpp18
-rw-r--r--src/remoteobjects/qremoteobjectsource.cpp21
-rw-r--r--src/remoteobjects/qremoteobjectsourceio.cpp31
-rw-r--r--src/remoteobjects/qremoteobjectsourceio_p.h1
-rw-r--r--tests/auto/integration/tst_integration.cpp24
-rw-r--r--tests/auto/modelreplica/tst_modelreplicatest.cpp34
13 files changed, 200 insertions, 69 deletions
diff --git a/dist/changes-5.12.0 b/dist/changes-5.12.0
new file mode 100644
index 0000000..0884e4f
--- /dev/null
+++ b/dist/changes-5.12.0
@@ -0,0 +1,46 @@
+Qt 5.12 introduces many new features and improvements as well as bugfixes
+over the 5.11.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+Note: Tech Preview modules are able to change APIs to refine or enhance the
+module's functionality. Thus Qt's binary compatibility quarantees aren't
+applicable. Code switching to 5.12.0 from earlier versions of Qt Remote
+Objects will need to be recompiled.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.12.0 Changes *
+****************************************************************************
+ - General
+ * [QTBUG-68678] Graduate Qt Remote Objects from TP to fully supported
+ module of Qt
+ * [QTBUG-65727] QtRemoteObjects: Documentation doesn't match the code
+
+ - QRemoteObjectNode
+ * Support externally created QIODevices, including SSL sockets.
+ * Added proxy() method to support use-cases like having a single node
+ provide a (for instance) tcp url for a device allowing access from
+ other devices, while using internal connections (like "local:*") on
+ the device.
+
+ - repc
+ * [QTBUG-68976] Cannot add comments in .rep file
+ * [QTBUG-68975] Support multiline PODs and ENUMs in repc
+ * [QTBUG-67770] repc should be able to use tab characters as a normal
+ whitespace
+
+****************************************************************************
+* QML *
+****************************************************************************
+
+ - Updated import statement to better match typical module pattern. From
+ QML "import QtRemoteObjects 5.12" should now be used.
diff --git a/examples/remoteobjects/ssl/sslcppclient/main.cpp b/examples/remoteobjects/ssl/sslcppclient/main.cpp
index ff67d70..2c64965 100644
--- a/examples/remoteobjects/ssl/sslcppclient/main.cpp
+++ b/examples/remoteobjects/ssl/sslcppclient/main.cpp
@@ -109,8 +109,9 @@ private:
socketClient->setPeerVerifyMode(QSslSocket::VerifyPeer);
socketClient->connectToHostEncrypted(QStringLiteral("127.0.0.1"), 65511);
if (!socketClient->waitForEncrypted(-1)) {
- qFatal("Failed to connect to server %s",
+ qWarning("Failed to connect to server %s",
qPrintable(socketClient->errorString()));
+ exit(0);
}
return socketClient;
}
diff --git a/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp b/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp
index 409f72d..b78602e 100644
--- a/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp
+++ b/src/remoteobjects/qremoteobjectabstractitemmodeladapter.cpp
@@ -71,7 +71,7 @@ QAbstractItemModelSourceAdapter::QAbstractItemModelSourceAdapter(QAbstractItemMo
m_model(obj),
m_availableRoles(roles)
{
- registerTypes();
+ QAbstractItemModelSourceAdapter::registerTypes();
m_selectionModel = sel;
connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), this, SLOT(sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(sourceRowsInserted(QModelIndex,int,int)));
@@ -85,22 +85,24 @@ QAbstractItemModelSourceAdapter::QAbstractItemModelSourceAdapter(QAbstractItemMo
void QAbstractItemModelSourceAdapter::registerTypes()
{
static bool alreadyRegistered = false;
- if (!alreadyRegistered) {
- alreadyRegistered = true;
- qRegisterMetaType<Qt::Orientation>();
- qRegisterMetaType<QVector<Qt::Orientation> >();
- qRegisterMetaTypeStreamOperators<ModelIndex>();
- qRegisterMetaTypeStreamOperators<IndexList>();
- qRegisterMetaTypeStreamOperators<DataEntries>();
- qRegisterMetaTypeStreamOperators<MetaAndDataEntries>();
- qRegisterMetaTypeStreamOperators<Qt::Orientation>();
- qRegisterMetaTypeStreamOperators<QVector<Qt::Orientation> >();
- qRegisterMetaType<QItemSelectionModel::SelectionFlags>();
- qRegisterMetaTypeStreamOperators<QItemSelectionModel::SelectionFlags>();
- qRegisterMetaType<QSize>();
- qRegisterMetaType<QIntHash>();
- qRegisterMetaTypeStreamOperators<QIntHash>();
- }
+ if (alreadyRegistered)
+ return;
+
+ alreadyRegistered = true;
+ qRegisterMetaType<QAbstractItemModel*>();
+ qRegisterMetaType<Qt::Orientation>();
+ qRegisterMetaType<QVector<Qt::Orientation> >();
+ qRegisterMetaTypeStreamOperators<ModelIndex>();
+ qRegisterMetaTypeStreamOperators<IndexList>();
+ qRegisterMetaTypeStreamOperators<DataEntries>();
+ qRegisterMetaTypeStreamOperators<MetaAndDataEntries>();
+ qRegisterMetaTypeStreamOperators<Qt::Orientation>();
+ qRegisterMetaTypeStreamOperators<QVector<Qt::Orientation> >();
+ qRegisterMetaType<QItemSelectionModel::SelectionFlags>();
+ qRegisterMetaTypeStreamOperators<QItemSelectionModel::SelectionFlags>();
+ qRegisterMetaType<QSize>();
+ qRegisterMetaType<QIntHash>();
+ qRegisterMetaTypeStreamOperators<QIntHash>();
}
QItemSelectionModel* QAbstractItemModelSourceAdapter::selectionModel() const
diff --git a/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h b/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h
index 4f1dbb0..4c9a972 100644
--- a/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h
+++ b/src/remoteobjects/qremoteobjectabstractitemmodeladapter_p.h
@@ -68,7 +68,7 @@ public:
Q_INVOKABLE explicit QAbstractItemModelSourceAdapter(QAbstractItemModel *object, QItemSelectionModel *sel, const QVector<int> &roles = QVector<int>());
Q_PROPERTY(QVector<int> availableRoles READ availableRoles WRITE setAvailableRoles NOTIFY availableRolesChanged)
Q_PROPERTY(QIntHash roleNames READ roleNames)
- void registerTypes();
+ static void registerTypes();
QItemSelectionModel* selectionModel() const;
public Q_SLOTS:
diff --git a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
index 1b2569c..5b13081 100644
--- a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
+++ b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
@@ -111,22 +111,24 @@ void QAbstractItemModelReplicaImplementation::initialize()
void QAbstractItemModelReplicaImplementation::registerMetatypes()
{
static bool alreadyRegistered = false;
- if (!alreadyRegistered) {
- alreadyRegistered = true;
- qRegisterMetaType<Qt::Orientation>();
- qRegisterMetaType<QVector<Qt::Orientation> >();
- qRegisterMetaTypeStreamOperators<ModelIndex>();
- qRegisterMetaTypeStreamOperators<IndexList>();
- qRegisterMetaTypeStreamOperators<DataEntries>();
- qRegisterMetaTypeStreamOperators<MetaAndDataEntries>();
- qRegisterMetaTypeStreamOperators<Qt::Orientation>();
- qRegisterMetaTypeStreamOperators<QVector<Qt::Orientation> >();
- qRegisterMetaTypeStreamOperators<QItemSelectionModel::SelectionFlags>();
- qRegisterMetaType<QItemSelectionModel::SelectionFlags>();
- qRegisterMetaType<QSize>();
- qRegisterMetaType<QIntHash>();
- qRegisterMetaTypeStreamOperators<QIntHash>();
- }
+ if (alreadyRegistered)
+ return;
+
+ alreadyRegistered = true;
+ qRegisterMetaType<QAbstractItemModel*>();
+ qRegisterMetaType<Qt::Orientation>();
+ qRegisterMetaType<QVector<Qt::Orientation> >();
+ qRegisterMetaTypeStreamOperators<ModelIndex>();
+ qRegisterMetaTypeStreamOperators<IndexList>();
+ qRegisterMetaTypeStreamOperators<DataEntries>();
+ qRegisterMetaTypeStreamOperators<MetaAndDataEntries>();
+ qRegisterMetaTypeStreamOperators<Qt::Orientation>();
+ qRegisterMetaTypeStreamOperators<QVector<Qt::Orientation> >();
+ qRegisterMetaTypeStreamOperators<QItemSelectionModel::SelectionFlags>();
+ qRegisterMetaType<QItemSelectionModel::SelectionFlags>();
+ qRegisterMetaType<QSize>();
+ qRegisterMetaType<QIntHash>();
+ qRegisterMetaTypeStreamOperators<QIntHash>();
}
void QAbstractItemModelReplicaImplementation::initializeModelConnections()
diff --git a/src/remoteobjects/qremoteobjectnode.cpp b/src/remoteobjects/qremoteobjectnode.cpp
index f095e1e..038d68e 100644
--- a/src/remoteobjects/qremoteobjectnode.cpp
+++ b/src/remoteobjects/qremoteobjectnode.cpp
@@ -1337,6 +1337,7 @@ void QRemoteObjectNodePrivate::onClientRead(QObject *obj)
\value MissingObjectName The given QObject does not have objectName() set.
\value HostUrlInvalid The given url has an invalid or unrecognized scheme.
\value ProtocolMismatch The client and the server have different protocol versions.
+ \value ListenFailed Can't listen on the specified host port.
*/
/*!
@@ -1376,6 +1377,8 @@ void QRemoteObjectNodePrivate::initialize()
qRegisterMetaType<QAbstractSocket::SocketError>(); //For queued qnx error()
qRegisterMetaTypeStreamOperators<QVector<int> >();
qRegisterMetaTypeStreamOperators<QRemoteObjectPackets::QRO_>();
+ // To support dynamic MODELs, we need to make sure the types are registered
+ QAbstractItemModelSourceAdapter::registerTypes();
}
bool QRemoteObjectNodePrivate::checkSignatures(const QByteArray &a, const QByteArray &b)
@@ -1599,6 +1602,13 @@ bool QRemoteObjectHostBase::setHostUrl(const QUrl &hostAddress, AllowedSchemas a
}
d->remoteObjectIo = new QRemoteObjectSourceIo(hostAddress, this);
+ if (allowedSchemas == AllowedSchemas::BuiltInSchemasOnly && !d->remoteObjectIo->startListening()) {
+ d->setLastError(ListenFailed);
+ delete d->remoteObjectIo;
+ d->remoteObjectIo = nullptr;
+ return false;
+ }
+
//If we've given a name to the node, set it on the sourceIo as well
if (!objectName().isEmpty())
d->remoteObjectIo->setObjectName(objectName());
@@ -1763,9 +1773,9 @@ QVariant QRemoteObjectNodePrivate::handlePointerToQObjectProperty(QConnectedRepl
const bool newReplica = !replicas.contains(childInfo.name) || rep->isInitialized();
if (newReplica) {
if (rep->isInitialized()) {
- auto rep = qSharedPointerCast<QConnectedReplicaImplementation>(replicas.take(childInfo.name));
- if (!rep->isShortCircuit())
- dynamicTypeManager.addFromReplica(static_cast<QConnectedReplicaImplementation *>(rep.data()));
+ auto childRep = qSharedPointerCast<QConnectedReplicaImplementation>(replicas.take(childInfo.name));
+ if (childRep && !childRep->isShortCircuit())
+ dynamicTypeManager.addFromReplica(static_cast<QConnectedReplicaImplementation *>(childRep.data()));
}
if (childInfo.type == ObjectType::CLASS)
retval = QVariant::fromValue(q->acquireDynamic(childInfo.name));
diff --git a/src/remoteobjects/qremoteobjectnode.h b/src/remoteobjects/qremoteobjectnode.h
index f2d00d6..d69b369 100644
--- a/src/remoteobjects/qremoteobjectnode.h
+++ b/src/remoteobjects/qremoteobjectnode.h
@@ -96,7 +96,8 @@ public:
SourceNotRegistered,
MissingObjectName,
HostUrlInvalid,
- ProtocolMismatch
+ ProtocolMismatch,
+ ListenFailed
};
Q_ENUM(ErrorCode)
diff --git a/src/remoteobjects/qremoteobjectpacket.cpp b/src/remoteobjects/qremoteobjectpacket.cpp
index ecf593c..a751824 100644
--- a/src/remoteobjects/qremoteobjectpacket.cpp
+++ b/src/remoteobjects/qremoteobjectpacket.cpp
@@ -39,6 +39,8 @@
#include "qremoteobjectpacket_p.h"
+#include <QAbstractItemModel>
+
#include "qremoteobjectpendingcall.h"
#include "qremoteobjectsource.h"
#include "qremoteobjectsource_p.h"
@@ -404,10 +406,24 @@ void serializePongPacket(DataStreamPacket &ds, const QString &name)
ds.finishPacket();
}
+static ObjectType objectType(const QString &typeName)
+{
+ if (typeName == QLatin1String("QAbstractItemModelAdapter"))
+ return ObjectType::MODEL;
+ auto tid = QMetaType::type(typeName.toUtf8());
+ if (tid == QMetaType::UnknownType)
+ return ObjectType::CLASS;
+ QMetaType type(tid);
+ auto mo = type.metaObject();
+ if (mo && mo->inherits(&QAbstractItemModel::staticMetaObject))
+ return ObjectType::MODEL;
+ return ObjectType::CLASS;
+}
+
QRO_::QRO_(QRemoteObjectSourceBase *source)
: name(source->name())
, typeName(source->m_api->typeName())
- , type(source->m_adapter ? ObjectType::MODEL : ObjectType::CLASS)
+ , type(source->m_adapter ? ObjectType::MODEL : objectType(typeName))
, isNull(source->m_object == nullptr)
, classDefinition()
{}
diff --git a/src/remoteobjects/qremoteobjectsource.cpp b/src/remoteobjects/qremoteobjectsource.cpp
index 36bee20..5cbc195 100644
--- a/src/remoteobjects/qremoteobjectsource.cpp
+++ b/src/remoteobjects/qremoteobjectsource.cpp
@@ -137,9 +137,10 @@ QRemoteObjectSourceBase::QRemoteObjectSourceBase(QObject *obj, Private *d, const
QRemoteObjectSource::QRemoteObjectSource(QObject *obj, Private *d, const SourceApiMap *api, QObject *adapter)
: QRemoteObjectSourceBase(obj, d, api, adapter)
- , m_name(adapter ? MODEL().arg(api->name()) : CLASS().arg(api->name()))
+ , m_name(api->typeName() == QLatin1String("QAbstractItemModelAdapter") ? MODEL().arg(api->name()) : CLASS().arg(api->name()))
{
- d->m_sourceIo->registerSource(this);
+ if (obj)
+ d->m_sourceIo->registerSource(this);
}
QRemoteObjectRootSource::QRemoteObjectRootSource(QObject *obj, const SourceApiMap *api,
@@ -182,11 +183,21 @@ void QRemoteObjectSourceBase::setConnections()
void QRemoteObjectSourceBase::resetObject(QObject *newObject)
{
- QObject::disconnect(m_object, 0, this, 0);
- if (m_adapter)
- QObject::disconnect(m_adapter, 0, this, 0);
+ if (m_object)
+ m_object->disconnect(this);
+ if (m_adapter) {
+ m_adapter->disconnect(this);
+ delete m_adapter;
+ m_adapter = nullptr;
+ }
m_object = newObject;
+ auto model = qobject_cast<QAbstractItemModel *>(newObject);
+ if (model) {
+ d->m_sourceIo->registerSource(this);
+ m_adapter = new QAbstractItemModelSourceAdapter(model, nullptr, model->roleNames().keys().toVector());
+ }
+
setParent(newObject);
if (newObject)
setConnections();
diff --git a/src/remoteobjects/qremoteobjectsourceio.cpp b/src/remoteobjects/qremoteobjectsourceio.cpp
index d864ed5..c5bf36e 100644
--- a/src/remoteobjects/qremoteobjectsourceio.cpp
+++ b/src/remoteobjects/qremoteobjectsourceio.cpp
@@ -54,21 +54,10 @@ QRemoteObjectSourceIo::QRemoteObjectSourceIo(const QUrl &address, QObject *paren
: QObject(parent)
, m_server(QtROServerFactory::instance()->isValid(address) ?
QtROServerFactory::instance()->create(address, this) : nullptr)
+ , m_address(address)
{
- if (m_server && m_server->listen(address)) {
- qRODebug(this) << "QRemoteObjectSourceIo is Listening" << address;
- } else {
- if (m_server) {
- qROWarning(this) << "Listen failed for URL:" << address;
- qROWarning(this) << m_server->serverError();
- } else {
- m_address = address;
- qRODebug(this) << "Using" << address << "as external url.";
- }
- return;
- }
-
- connect(m_server.data(), &QConnectionAbstractServer::newConnection, this, &QRemoteObjectSourceIo::handleConnection);
+ if (m_server == nullptr)
+ qRODebug(this) << "Using" << m_address << "as external url.";
}
QRemoteObjectSourceIo::QRemoteObjectSourceIo(QObject *parent)
@@ -82,6 +71,20 @@ QRemoteObjectSourceIo::~QRemoteObjectSourceIo()
qDeleteAll(m_sourceRoots.values());
}
+bool QRemoteObjectSourceIo::startListening()
+{
+ if (!m_server->listen(m_address)) {
+ qROCritical(this) << "Listen failed for URL:" << m_address;
+ qROCritical(this) << m_server->serverError();
+ return false;
+ }
+
+ qRODebug(this) << "QRemoteObjectSourceIo is Listening" << m_address;
+ connect(m_server.data(), &QConnectionAbstractServer::newConnection, this,
+ &QRemoteObjectSourceIo::handleConnection);
+ return true;
+}
+
bool QRemoteObjectSourceIo::enableRemoting(QObject *object, const QMetaObject *meta, const QString &name, const QString &typeName)
{
if (m_sourceRoots.contains(name)) {
diff --git a/src/remoteobjects/qremoteobjectsourceio_p.h b/src/remoteobjects/qremoteobjectsourceio_p.h
index 4cc045c..59f9888 100644
--- a/src/remoteobjects/qremoteobjectsourceio_p.h
+++ b/src/remoteobjects/qremoteobjectsourceio_p.h
@@ -73,6 +73,7 @@ public:
explicit QRemoteObjectSourceIo(QObject *parent = nullptr);
~QRemoteObjectSourceIo() override;
+ bool startListening();
bool enableRemoting(QObject *object, const QMetaObject *meta, const QString &name,
const QString &typeName);
bool enableRemoting(QObject *object, const SourceApiMap *api, QObject *adapter = nullptr);
diff --git a/tests/auto/integration/tst_integration.cpp b/tests/auto/integration/tst_integration.cpp
index 8643002..5c42319 100644
--- a/tests/auto/integration/tst_integration.cpp
+++ b/tests/auto/integration/tst_integration.cpp
@@ -210,14 +210,14 @@ private slots:
QTest::addColumn<QUrl>("hostUrl");
QTest::addColumn<QUrl>("registryUrl");
-#ifndef SKIP_LOCAL
- QTest::newRow("local") << QUrl(QLatin1String("local:replica_local_integration")) << QUrl(QLatin1String("local:registry_local_integration"));
-#endif
QTest::newRow("tcp") << QUrl(QLatin1String("tcp://127.0.0.1:65511")) << QUrl(QLatin1String("tcp://127.0.0.1:65512"));
- QTest::newRow("external") << QUrl() << QUrl();
#ifdef __QNXNTO__
QTest::newRow("qnx") << QUrl(QLatin1String("qnx:replica")) << QUrl(QLatin1String("qnx:registry"));
#endif
+#ifndef SKIP_LOCAL
+ QTest::newRow("local") << QUrl(QLatin1String("local:replica_local_integration")) << QUrl(QLatin1String("local:registry_local_integration"));
+#endif
+ QTest::newRow("external") << QUrl() << QUrl();
}
void initTestCase()
@@ -1368,6 +1368,22 @@ private slots:
QVERIFY(testServer.waitForFinished());
}
#endif
+
+ void tcpListenFailedTest()
+ {
+ QFETCH_GLOBAL(QUrl, registryUrl);
+
+ if (registryUrl.scheme() != QRemoteObjectStringLiterals::tcp())
+ QSKIP("Skipping test for local and external backends.");
+
+ // Need the Host or Registry running so that the port is in use.
+ setupRegistry();
+ QRemoteObjectHost badHost;
+ badHost.setHostUrl(registryUrl);
+ QCOMPARE(badHost.lastError(), QRemoteObjectNode::ListenFailed);
+
+ }
+
};
QTEST_MAIN(tst_Integration)
diff --git a/tests/auto/modelreplica/tst_modelreplicatest.cpp b/tests/auto/modelreplica/tst_modelreplicatest.cpp
index 0e6b2d2..1e3f5eb 100644
--- a/tests/auto/modelreplica/tst_modelreplicatest.cpp
+++ b/tests/auto/modelreplica/tst_modelreplicatest.cpp
@@ -35,17 +35,14 @@ class ModelreplicaTest : public QObject
Q_OBJECT
public:
- ModelreplicaTest();
+ ModelreplicaTest() = default;
private Q_SLOTS:
void basicFunctions();
void basicFunctions_data();
+ void nullModel();
};
-ModelreplicaTest::ModelreplicaTest()
-{
-}
-
void ModelreplicaTest::basicFunctions_data()
{
QTest::addColumn<bool>("templated");
@@ -58,7 +55,7 @@ void ModelreplicaTest::basicFunctions()
QFETCH(bool, templated);
QRemoteObjectRegistryHost host(QUrl("tcp://localhost:5555"));
- QStringListModel *model = new QStringListModel();
+ auto model = new QStringListModel();
model->setStringList(QStringList() << "Track1" << "Track2" << "Track3");
MediaSimpleSource source;
source.setTracks(model);
@@ -91,6 +88,31 @@ void ModelreplicaTest::basicFunctions()
}
}
+void ModelreplicaTest::nullModel()
+{
+ QRemoteObjectRegistryHost host(QUrl("tcp://localhost:5555"));
+ MediaSimpleSource source;
+ host.enableRemoting(&source);
+
+ QRemoteObjectNode client(QUrl("tcp://localhost:5555"));
+ const QScopedPointer<MediaReplica> replica(client.acquire<MediaReplica>());
+ QVERIFY(replica->waitForSource(100));
+
+ auto model = new QStringListModel(this);
+ model->setStringList(QStringList() << "Track1" << "Track2" << "Track3");
+ source.setTracks(model);
+
+ QTRY_VERIFY(replica->tracks());
+ QTRY_COMPARE(replica->tracks()->rowCount(), 3);
+ QTRY_COMPARE(replica->tracks()->data(replica->tracks()->index(0, 0)), "Track1");
+
+ model = new QStringListModel(this);
+ model->setStringList(QStringList() << "New Track1" << "New Track2" << "New Track3" << "New Track4");
+ source.setTracks(model);
+ QTRY_COMPARE(replica->tracks()->rowCount(), 4);
+ QTRY_COMPARE(replica->tracks()->data(replica->tracks()->index(3, 0)), "New Track4");
+}
+
QTEST_MAIN(ModelreplicaTest)
#include "tst_modelreplicatest.moc"