Skip to content

Commit

Permalink
Qt6: Q{Text,Data}Stream::endl
Browse files Browse the repository at this point in the history
These have been removed in Qt6, use Qt::endl instead (compiles with
Qt5.15 LTS).

Signed-off-by: John Bowler <jbowler@acm.org>
  • Loading branch information
jbowler committed Oct 2, 2023
1 parent 1801491 commit d9450b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion generator/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void Generator::printClasses()
if (!shouldGenerate(cls))
continue;
write(s, cls);
s << endl << endl;
s << Qt::endl << Qt::endl;
}
}

Expand Down
14 changes: 7 additions & 7 deletions generator/typesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@ QString formattedCodeHelper(QTextStream &s, Indentor &indentor, QStringList &lin
const QString line = lines.takeFirst().trimmed();
if (line.isEmpty()) {
if (!lastEmpty)
s << endl;
s << Qt::endl;
lastEmpty = true;
continue;
} else {
Expand All @@ -1781,23 +1781,23 @@ QString formattedCodeHelper(QTextStream &s, Indentor &indentor, QStringList &lin
s << indentor;
if (line.startsWith("*"))
s << " ";
s << line << endl;
s << line << Qt::endl;
if (line.endsWith("*/"))
multilineComment = false;
} else if (line.startsWith("}")) {
return line;
} else if (line.endsWith("}")) {
s << indentor << line << endl;
s << indentor << line << Qt::endl;
return 0;
} else if(line.endsWith("{")) {
s << indentor << line << endl;
s << indentor << line << Qt::endl;
QString tmp;
{
Indentation indent(indentor);
tmp = formattedCodeHelper(s, indentor, lines);
}
if (!tmp.isNull()) {
s << indentor << tmp << endl;
s << indentor << tmp << Qt::endl;
}
lastLine = tmp;
continue;
Expand All @@ -1811,7 +1811,7 @@ QString formattedCodeHelper(QTextStream &s, Indentor &indentor, QStringList &lin
!lastLine.endsWith("}") &&
!line.startsWith("{"))
s << " ";
s << line << endl;
s << line << Qt::endl;
}
lastLine = line;
}
Expand All @@ -1825,7 +1825,7 @@ QTextStream &CodeSnip::formattedCode(QTextStream &s, Indentor &indentor) const
while (!lst.isEmpty()) {
QString tmp = formattedCodeHelper(s, indentor, lst);
if (!tmp.isNull()) {
s << indentor << tmp << endl;
s << indentor << tmp << Qt::endl;
}
}
s.flush();
Expand Down

0 comments on commit d9450b8

Please sign in to comment.