Correct Qt version checks

This commit is contained in:
Bill Somerville 2020-11-03 23:44:07 +00:00
parent 50cce43e92
commit f4db2904a3
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 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) else if (schema <= 2)
{ {
setVersion (QDataStream::Qt_5_2); // Qt schema version setVersion (QDataStream::Qt_5_2); // Qt schema version
} }
#endif #endif
#if QT_VERSION >= 0x050400 #if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
else if (schema <= 3) else if (schema <= 3)
{ {
setVersion (QDataStream::Qt_5_4); // Qt schema version setVersion (QDataStream::Qt_5_4); // Qt schema version
@ -73,13 +73,13 @@ namespace NetworkMessage
{ {
parent->setVersion (QDataStream::Qt_5_0); parent->setVersion (QDataStream::Qt_5_0);
} }
#if QT_VERSION >= 0x050200 #if QT_VERSION >= QT_VERSION_CHECK (5, 2, 0)
else if (schema_ <= 2) else if (schema_ <= 2)
{ {
parent->setVersion (QDataStream::Qt_5_2); parent->setVersion (QDataStream::Qt_5_2);
} }
#endif #endif
#if QT_VERSION >= 0x050400 #if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
else if (schema_ <= 3) else if (schema_ <= 3)
{ {
parent->setVersion (QDataStream::Qt_5_4); 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 // increment this if a newer Qt schema is required and add decode
// logic to the Builder and Reader class implementations // 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}; 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}; static quint32 constexpr schema_number {2};
#else #else
// Schema 1 (Qt_5_0) is broken // 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_opened, this, &Server::add_client);
connect (server_, &MessageServer::client_closed, this, &Server::remove_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 ()}); server_->start (port, multicast_group, QSet<QString> {network_interface_names.begin (), network_interface_names.end ()});
#else #else
server_->start (port, multicast_group, network_interface_names.toSet ()); server_->start (port, multicast_group, network_interface_names.toSet ());

View File

@ -120,7 +120,7 @@ namespace std
inline inline
bool is_broadcast_address (QHostAddress const& host_addr) 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 (); return host_addr.isBroadcast ();
#else #else
bool ok; bool ok;
@ -131,7 +131,7 @@ bool is_broadcast_address (QHostAddress const& host_addr)
inline inline
bool is_multicast_address (QHostAddress const& host_addr) 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 (); return host_addr.isMulticast ();
#else #else
bool ok; bool ok;