Correct Qt version checks

This commit is contained in:
Bill Somerville 2020-11-03 23:44:07 +00:00
parent d70cf120b5
commit 11497cf0b1
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
4 changed files with 9 additions and 9 deletions

View File

@ -28,13 +28,13 @@ namespace NetworkMessage
{
setVersion (QDataStream::Qt_5_0); // Qt schema version
}
#if QT_VERSION >= 0x050200
#if QT_VERSION >= QT_VERSION_CHECK (5, 2, 0)
else if (schema <= 2)
{
setVersion (QDataStream::Qt_5_2); // Qt schema version
}
#endif
#if QT_VERSION >= 0x050400
#if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
else if (schema <= 3)
{
setVersion (QDataStream::Qt_5_4); // Qt schema version
@ -73,13 +73,13 @@ namespace NetworkMessage
{
parent->setVersion (QDataStream::Qt_5_0);
}
#if QT_VERSION >= 0x050200
#if QT_VERSION >= QT_VERSION_CHECK (5, 2, 0)
else if (schema_ <= 2)
{
parent->setVersion (QDataStream::Qt_5_2);
}
#endif
#if QT_VERSION >= 0x050400
#if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
else if (schema_ <= 3)
{
parent->setVersion (QDataStream::Qt_5_4);

View File

@ -540,9 +540,9 @@ namespace NetworkMessage
// increment this if a newer Qt schema is required and add decode
// logic to the Builder and Reader class implementations
#if QT_VERSION >= 0x050400
#if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
static quint32 constexpr schema_number {3};
#elif QT_VERSION >= 0x050200
#elif QT_VERSION >= QT_VERSION_CHECK (5, 2, 0)
static quint32 constexpr schema_number {2};
#else
// Schema 1 (Qt_5_0) is broken

View File

@ -169,7 +169,7 @@ public:
connect (server_, &MessageServer::client_opened, this, &Server::add_client);
connect (server_, &MessageServer::client_closed, this, &Server::remove_client);
#if QT_VERSION >= 0x051400
#if QT_VERSION >= QT_VERSION_CHECK (5, 14, 0)
server_->start (port, multicast_group, QSet<QString> {network_interface_names.begin (), network_interface_names.end ()});
#else
server_->start (port, multicast_group, network_interface_names.toSet ());

View File

@ -120,7 +120,7 @@ namespace std
inline
bool is_broadcast_address (QHostAddress const& host_addr)
{
#if QT_VERSION >= 0x051100
#if QT_VERSION >= QT_VERSION_CHECK (5, 11, 0)
return host_addr.isBroadcast ();
#else
bool ok;
@ -131,7 +131,7 @@ bool is_broadcast_address (QHostAddress const& host_addr)
inline
bool is_multicast_address (QHostAddress const& host_addr)
{
#if QT_VERSION >= 0x050600
#if QT_VERSION >= QT_VERSION_CHECK (5, 6, 0)
return host_addr.isMulticast ();
#else
bool ok;