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 // keep the initial context alive in any case
Q_ASSERT(!isEmpty()); Q_ASSERT(!isEmpty());
const bool initialContextSurvived = m_contextStack.size() > popCount; 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; return initialContextSurvived;
} }

View File

@@ -256,7 +256,11 @@ bool ServerCapabilities::SemanticHighlightingServerCapabilities::isValid(ErrorHi
{ {
return contains(scopesKey) && value(scopesKey).isArray() return contains(scopesKey) && value(scopesKey).isArray()
&& Utils::allOf(value(scopesKey).toArray(), [](const QJsonValue &array) { && 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); 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(); filterEntry.extraInfo = bookmark->fileName().toString();
int highlightIndex = filterEntry.displayName.indexOf(entry, 0, Qt::CaseInsensitive); int highlightIndex = filterEntry.displayName.indexOf(entry, 0, Qt::CaseInsensitive);
if (highlightIndex >= 0) { if (highlightIndex >= 0) {
filterEntry.highlightInfo = {highlightIndex, entry.length()}; filterEntry.highlightInfo = {highlightIndex, int(entry.length())};
} else { } else {
highlightIndex = filterEntry.extraInfo.indexOf(entry, 0, Qt::CaseInsensitive); highlightIndex = filterEntry.extraInfo.indexOf(entry, 0, Qt::CaseInsensitive);
if (highlightIndex >= 0) { if (highlightIndex >= 0) {
filterEntry.highlightInfo = {highlightIndex, entry.length(), filterEntry.highlightInfo = {highlightIndex, int(entry.length()),
LocatorFilterEntry::HighlightInfo::ExtraInfo}; LocatorFilterEntry::HighlightInfo::ExtraInfo};
} else if (colonIndex >= 0) { } else if (colonIndex >= 0) {
const QString fileName = entry.left(colonIndex); const QString fileName = entry.left(colonIndex);
const QString lineNumber = entry.mid(colonIndex + 1); const QString lineNumber = entry.mid(colonIndex + 1);
highlightIndex = filterEntry.displayName.indexOf(fileName, 0, Qt::CaseInsensitive); highlightIndex = filterEntry.displayName.indexOf(fileName, 0, Qt::CaseInsensitive);
if (highlightIndex >= 0) { if (highlightIndex >= 0) {
filterEntry.highlightInfo = {highlightIndex, fileName.length()}; filterEntry.highlightInfo = {highlightIndex, int(fileName.length())};
highlightIndex = filterEntry.displayName.indexOf( highlightIndex = filterEntry.displayName.indexOf(
lineNumber, highlightIndex, Qt::CaseInsensitive); lineNumber, highlightIndex, Qt::CaseInsensitive);
if (highlightIndex >= 0) { if (highlightIndex >= 0) {

View File

@@ -2294,7 +2294,7 @@ void CdbEngine::parseOutputLine(QString line)
if (debug) if (debug)
qDebug("### Completed builtin command '%s' for token=%d, %d lines, pending=%d", qDebug("### Completed builtin command '%s' for token=%d, %d lines, pending=%d",
qPrintable(command.function), m_currentBuiltinResponseToken, 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); QTC_ASSERT(token == m_currentBuiltinResponseToken, return);
showMessage(m_currentBuiltinResponse, LogMisc); showMessage(m_currentBuiltinResponse, LogMisc);
if (command.callback) { if (command.callback) {

View File

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

View File

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