QmlDesigner: Flush the output stream after sending commands

The output stream should be flushed in order to forward containing data
and clear the stream buffer.

Task-number: QDS-9871
Change-Id: Iec9903a8afb98f3b9d03a9b9c4de67b6bfe3d35b
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Ali Kianian
2023-05-25 09:23:45 +03:00
parent fbc4848f96
commit 1dafc64a54
3 changed files with 9 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ NodeInstanceClientProxy::NodeInstanceClientProxy(QObject *parent)
: QObject(parent)
, m_inputIoDevice(nullptr)
, m_outputIoDevice(nullptr)
, m_localSocket(nullptr)
, m_writeCommandCounter(0)
, m_synchronizeId(-1)
{
@@ -101,6 +102,7 @@ void NodeInstanceClientProxy::initializeSocket()
m_inputIoDevice = localSocket;
m_outputIoDevice = localSocket;
m_localSocket = localSocket;
}
void NodeInstanceClientProxy::initializeCapturedStream(const QString &fileName)
@@ -288,6 +290,8 @@ void NodeInstanceClientProxy::sceneCreated(const SceneCreatedCommand &command)
void NodeInstanceClientProxy::flush()
{
if (m_localSocket)
m_localSocket->flush();
}
void NodeInstanceClientProxy::synchronizeWithClientProcess()

View File

@@ -117,6 +117,7 @@ private:
QTimer m_puppetAliveTimer;
QIODevice *m_inputIoDevice;
QIODevice *m_outputIoDevice;
QLocalSocket *m_localSocket;
std::unique_ptr<NodeInstanceServerInterface> m_nodeInstanceServer;
quint32 m_writeCommandCounter;
int m_synchronizeId;

View File

@@ -97,10 +97,11 @@ void Qt5BakeLightsNodeInstanceServer::bakeLights()
switch (status) {
case QQuick3DLightmapBaker::BakingStatus::Progress:
case QQuick3DLightmapBaker::BakingStatus::Warning:
case QQuick3DLightmapBaker::BakingStatus::Error:
case QQuick3DLightmapBaker::BakingStatus::Error: {
nodeInstanceClient()->handlePuppetToCreatorCommand(
{PuppetToCreatorCommand::BakeLightsProgress, msg.value_or("")});
break;
{PuppetToCreatorCommand::BakeLightsProgress, msg.value_or("")});
nodeInstanceClient()->flush();
} break;
case QQuick3DLightmapBaker::BakingStatus::Cancelled:
abort(tr("Baking cancelled."));
break;