Qt6 migration

This commit is contained in:
eelke 2021-03-06 13:13:31 +01:00
parent 87553b2554
commit 423043d431
19 changed files with 64 additions and 87 deletions

View file

@ -7,14 +7,6 @@
namespace {
class registerMetaTypes {
public:
registerMetaTypes()
{
qRegisterMetaTypeStreamOperators<ConnectionConfig>("ConnectionConfig");
}
} registerMetaTypes_instance;
struct {
SslMode mode;
const char* string;

View file

@ -5,7 +5,7 @@
void FormatToStream(QTextStream &stream, QString format, std::function<void(QTextStream &, QString)> field_callback)
{
// Use static to optimize only once
static QRegularExpression cached_find_var_re("(?:[^\\\\]|^)(\\/%([a-zA-Z0-9_-]+)%\\/)", QRegularExpression::OptimizeOnFirstUsageOption);
static QRegularExpression cached_find_var_re("(?:[^\\\\]|^)(\\/%([a-zA-Z0-9_-]+)%\\/)");
int from = 0;
QRegularExpressionMatch match;
@ -17,7 +17,7 @@ void FormatToStream(QTextStream &stream, QString format, std::function<void(QTex
++from;
}
// copy code before the var to the stream
stream << format.midRef(from, match.capturedStart(1) - from);
stream << format.mid(from, match.capturedStart(1) - from);
field_callback(stream, match.captured(2));
from = match.capturedEnd()-1; // -1 because it wants to match one character before or start of line to make sure there is no backslash
}
@ -25,5 +25,5 @@ void FormatToStream(QTextStream &stream, QString format, std::function<void(QTex
// same reason as at the start of the loop
++from;
}
stream << format.midRef(from);
stream << format.mid(from);
}

View file

@ -2,7 +2,7 @@
/**
*/
QString convert(QStringRef in, ConvertToNumericEscape conversion, NumericEscapeFormat format, QString prefix)
QString convert(QStringView in, ConvertToNumericEscape conversion, NumericEscapeFormat format, QString prefix)
{
return "";
return "TODO";
}

View file

@ -86,7 +86,7 @@ void copySelectionToClipboard(const QTableView *view)
if (selectedIndexes.count() > 0) {
QString clipboard_string;
QTextStream out(&clipboard_string, QIODevice::WriteOnly);
QTextStream out(&clipboard_string, QTextStream::WriteOnly);
CsvWriter csv(&out);
csv.setSeperator('\t');
csv.setQuote('"');
@ -153,7 +153,7 @@ QString ConvertToMultiLineCString(const QString &in_)
if (token.ok) {
if (token.tokenType == BasicTokenType::Comment) {
// save comment is seperate variable
comment = "//" + token.out.rightRef(token.out.length()-2);
comment = "//" + token.out.right(token.out.length()-2);
// Trim whitespace on right
int idx;
for (idx = comment.length() - 1; idx >= 0 && comment[idx].isSpace(); --idx) ;
@ -168,7 +168,7 @@ QString ConvertToMultiLineCString(const QString &in_)
++idx;
if (!comment.isEmpty()) {
// put the whitespace in front of the comment so it will be outside the contents of the string literal but alignment of comments is preserved
comment = line.rightRef(line.length() - (idx)) + comment;
comment = line.right(line.length() - (idx)) + comment;
}
line.truncate(idx);
}