Small Qt 6 migration stuff

- qsizetype vs int
- QJsonValue vs QJsonValueRef
- #include for metatype system

Task-number: QTCREATORBUG-24098
Change-Id: I066d9e3d5c35766b8aa3adc1c5835b23feb20b37
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-07-29 14:47:28 +02:00
parent 77d13f08ba
commit 6c590531b0
6 changed files with 11 additions and 7 deletions

View File

@@ -68,7 +68,7 @@ bool StateData::pop(int popCount)
// keep the initial context alive in any case
Q_ASSERT(!isEmpty());
const bool initialContextSurvived = m_contextStack.size() > popCount;
m_contextStack.resize(std::max(1, m_contextStack.size() - popCount));
m_contextStack.resize(std::max(1, int(m_contextStack.size()) - popCount));
return initialContextSurvived;
}

View File

@@ -256,7 +256,11 @@ bool ServerCapabilities::SemanticHighlightingServerCapabilities::isValid(ErrorHi
{
return contains(scopesKey) && value(scopesKey).isArray()
&& Utils::allOf(value(scopesKey).toArray(), [](const QJsonValue &array) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return array.isArray() && Utils::allOf(array.toArray(), &QJsonValue::isString);
#else
return array.isArray() && Utils::allOf(array.toArray(), &QJsonValueRef::isString);
#endif
});
}

View File

@@ -89,18 +89,18 @@ QList<LocatorFilterEntry> BookmarkFilter::matchesFor(QFutureInterface<LocatorFil
filterEntry.extraInfo = bookmark->fileName().toString();
int highlightIndex = filterEntry.displayName.indexOf(entry, 0, Qt::CaseInsensitive);
if (highlightIndex >= 0) {
filterEntry.highlightInfo = {highlightIndex, entry.length()};
filterEntry.highlightInfo = {highlightIndex, int(entry.length())};
} else {
highlightIndex = filterEntry.extraInfo.indexOf(entry, 0, Qt::CaseInsensitive);
if (highlightIndex >= 0) {
filterEntry.highlightInfo = {highlightIndex, entry.length(),
filterEntry.highlightInfo = {highlightIndex, int(entry.length()),
LocatorFilterEntry::HighlightInfo::ExtraInfo};
} else if (colonIndex >= 0) {
const QString fileName = entry.left(colonIndex);
const QString lineNumber = entry.mid(colonIndex + 1);
highlightIndex = filterEntry.displayName.indexOf(fileName, 0, Qt::CaseInsensitive);
if (highlightIndex >= 0) {
filterEntry.highlightInfo = {highlightIndex, fileName.length()};
filterEntry.highlightInfo = {highlightIndex, int(fileName.length())};
highlightIndex = filterEntry.displayName.indexOf(
lineNumber, highlightIndex, Qt::CaseInsensitive);
if (highlightIndex >= 0) {

View File

@@ -2294,7 +2294,7 @@ void CdbEngine::parseOutputLine(QString line)
if (debug)
qDebug("### Completed builtin command '%s' for token=%d, %d lines, pending=%d",
qPrintable(command.function), m_currentBuiltinResponseToken,
m_currentBuiltinResponse.count('\n'), int(m_commandForToken.size() - 1));
int(m_currentBuiltinResponse.count('\n')), int(m_commandForToken.size() - 1));
QTC_ASSERT(token == m_currentBuiltinResponseToken, return);
showMessage(m_currentBuiltinResponse, LogMisc);
if (command.callback) {

View File

@@ -2028,7 +2028,7 @@ InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader,
const QStringList &itemPaths = reader->values(pathVar);
if (itemPaths.count() != 1) {
qDebug("Invalid RHS: Variable '%s' has %d values.",
qPrintable(pathVar), itemPaths.count());
qPrintable(pathVar), int(itemPaths.count()));
if (itemPaths.isEmpty()) {
qDebug("%s: Ignoring INSTALLS item '%s', because it has no path.",
qPrintable(projectFilePath), qPrintable(item));

View File

@@ -30,9 +30,9 @@
#include <texteditor/texteditor.h>
#include <QSet>
#include <QTextCodec>
QT_BEGIN_NAMESPACE
class QTextCodec;
class QTextCursor;
QT_END_NAMESPACE