Qt6: deal with changes from QStringRef to QStringView

QStringRef is gone in Qt6 and mostly replaced by QStringView.  The one major
difference is that direct comparisons with string literals are no longer
possible.

Thanks to Thiago Macieira for helping me avoid more conditional compilation
here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-02-09 16:04:33 -08:00
parent 47d900bee5
commit 78361ef8e3
3 changed files with 25 additions and 7 deletions

16
core/namecmp.h Normal file
View file

@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#ifndef NAMECMP_H
#define NAMECMP_H
#ifdef __cplusplus
#include <QXmlStreamReader>
// this is annoying Qt5 / Qt6 incompatibility where we can't compare against string literals anymore
static inline int nameCmp(QXmlStreamReader &r, const char * cs)
{
return r.name().compare(QLatin1String(cs));
}
#endif
#endif // NAMECMP_H