aboutsummaryrefslogtreecommitdiff
path: root/singleapplication_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'singleapplication_p.cpp')
-rw-r--r--singleapplication_p.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp
index 1edd2b8..c1bdff4 100644
--- a/singleapplication_p.cpp
+++ b/singleapplication_p.cpp
@@ -207,7 +207,11 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
// Notify the parent that a new instance had been started;
QByteArray initMsg;
QDataStream writeStream(&initMsg, QIODevice::WriteOnly);
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
writeStream.setVersion(QDataStream::Qt_5_6);
+#endif
+
writeStream << blockServerName.toLatin1();
writeStream << static_cast<quint8>(connectionType);
writeStream << instanceNumber;
@@ -217,7 +221,10 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
// The header indicates the message length that follows
QByteArray header;
QDataStream headerStream(&header, QIODevice::WriteOnly);
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
headerStream.setVersion(QDataStream::Qt_5_6);
+#endif
headerStream << static_cast <quint64>( initMsg.length() );
socket->write( header );
@@ -300,7 +307,10 @@ void SingleApplicationPrivate::readInitMessageHeader( QLocalSocket *sock )
}
QDataStream headerStream( sock );
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
headerStream.setVersion( QDataStream::Qt_5_6 );
+#endif
// Read the header to know the message length
quint64 msgLen = 0;
@@ -330,7 +340,10 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
// Read the message body
QByteArray msgBytes = sock->read(info.msgLen);
QDataStream readStream(msgBytes);
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
readStream.setVersion( QDataStream::Qt_5_6 );
+#endif
// server name
QByteArray latin1Name;