Skip to content

Commit

Permalink
Qt6: QString::SkipEmptyParts moved to Qt (#119)
Browse files Browse the repository at this point in the history
 - replaced it and added backwards compatibility
  • Loading branch information
jbowler authored and mrbean-bremen committed Nov 2, 2023
1 parent 0359fd4 commit 72239a3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion generator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int main(int argc, char *argv[])
FileOut::license = true;

if (args.contains("rebuild-only")) {
QStringList classes = args.value("rebuild-only").split(",", QString::SkipEmptyParts);
QStringList classes = args.value("rebuild-only").split(",", Qt::SkipEmptyParts);
TypeDatabase::instance()->setRebuildClasses(classes);
}

Expand Down
2 changes: 1 addition & 1 deletion generator/setupgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static QStringList getOperatorCodes(const AbstractMetaClass* cls) {
CodeSnipList code_snips = cls->typeEntry()->codeSnips();
for (const CodeSnip &cs : code_snips) {
if (cs.language == TypeSystem::PyWrapperOperators) {
QStringList values = cs.code().split(" ", QString::SkipEmptyParts);
QStringList values = cs.code().split(" ", Qt::SkipEmptyParts);
for (QString value : values) {
r.insert(value);
}
Expand Down
13 changes: 12 additions & 1 deletion generator/typesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
#include <QtCore/QMap>
#include <QDebug>

/* QString::SkipEmptyParts was replicated in Qt::SplitBehavior in 15.4 and the
* QString original deprecated then it was removed in Qt6. This provides
* forward compatibility with Qt6 for versions of Qt prior to 15.4:
*/
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
namespace Qt {
const QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
};
#endif

class Indentor;

class AbstractMetaType;
Expand Down Expand Up @@ -1159,7 +1169,8 @@ class TypeDatabase
foreach (const QString &_warning, m_suppressedWarnings) {
QString warning(QString(_warning).replace("\\*", "&place_holder_for_asterisk;"));

QStringList segs = warning.split("*", QString::SkipEmptyParts);
QStringList segs = warning.split("*", Qt::SkipEmptyParts);

if (segs.size() == 0)
continue ;

Expand Down

0 comments on commit 72239a3

Please sign in to comment.