@@ -91,7 +91,11 @@ bool BrowserPrivate::updateService(const QByteArray &fqName)
9191 QList<Record> txtRecords;
9292 if (cache->lookupRecords (fqName, TXT, txtRecords)) {
9393 QMap<QByteArray, QByteArray> attributes;
94- for (const Record &record : std::as_const (txtRecords)) {
94+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
95+ for (const Record &record : std::as_const (txtRecords)) {
96+ #else
97+ for (const Record &record : qAsConst (txtRecords)) {
98+ #endif
9599 for (auto i = record.attributes ().constBegin ();
96100 i != record.attributes ().constEnd (); ++i) {
97101 attributes.insert (i.key (), i.value ());
@@ -156,7 +160,11 @@ void BrowserPrivate::onMessageReceived(const Message &message)
156160 // For each of the services marked to be updated, perform the update and
157161 // make a list of all missing SRV records
158162 QSet<QByteArray> queryNames;
159- for (const QByteArray &name : std::as_const (updateNames)) {
163+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
164+ for (const QByteArray &name : std::as_const (updateNames)) {
165+ #else
166+ for (const QByteArray &name : qAsConst (updateNames)) {
167+ #endif
160168 if (updateService (name)) {
161169 queryNames.insert (name);
162170 }
@@ -180,7 +188,11 @@ void BrowserPrivate::onMessageReceived(const Message &message)
180188 // Build and send a query for all of the SRV and TXT records
181189 if (queryNames.count ()) {
182190 Message queryMessage;
183- for (const QByteArray &name : std::as_const (queryNames)) {
191+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
192+ for (const QByteArray &name : std::as_const (queryNames)) {
193+ #else
194+ for (const QByteArray &name : qAsConst (queryNames)) {
195+ #endif
184196 Query query;
185197 query.setName (name);
186198 query.setType (SRV);
@@ -242,7 +254,11 @@ void BrowserPrivate::onQueryTimeout()
242254 // Include PTR records for the target that are already known
243255 QList<Record> records;
244256 if (cache->lookupRecords (query.name (), PTR, records)) {
245- for (const Record &record : std::as_const (records)) {
257+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
258+ for (const Record &record : std::as_const (records)) {
259+ #else
260+ for (const Record &record : qAsConst (records)) {
261+ #endif
246262 message.addRecord (record);
247263 }
248264 }
@@ -255,8 +271,11 @@ void BrowserPrivate::onServiceTimeout()
255271{
256272 if (ptrTargets.count ()) {
257273 Message message;
258- for (const QByteArray &target : std::as_const (ptrTargets)) {
259-
274+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
275+ for (const QByteArray &target : std::as_const (ptrTargets)) {
276+ #else
277+ for (const QByteArray &target : qAsConst (ptrTargets)) {
278+ #endif
260279 // Add a query for PTR records
261280 Query query;
262281 query.setName (target);
@@ -266,7 +285,11 @@ void BrowserPrivate::onServiceTimeout()
266285 // Include PTR records for the target that are already known
267286 QList<Record> records;
268287 if (cache->lookupRecords (target, PTR, records)) {
269- for (const Record &record : std::as_const (records)) {
288+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
289+ for (const Record &record : std::as_const (records)) {
290+ #else
291+ for (const Record &record : qAsConst (records)) {
292+ #endif
270293 message.addRecord (record);
271294 }
272295 }
0 commit comments