Partial compile fix for current Qt dev and/or Qt 6

This does not cover Utils::MapReduceOption with QVector, and code
that's not compiled on my machine.

Change-Id: Ib63923985c52b1bb74e5ec2068a2bb37469ac618
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-11-12 10:26:38 +01:00
parent 817f81cbfd
commit 0120e462b2
27 changed files with 45 additions and 36 deletions

View File

@@ -31,7 +31,6 @@
#include <QQmlEngine> #include <QQmlEngine>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlExpression> #include <QQmlExpression>
#include <QMutableListIterator>
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {

View File

@@ -52,7 +52,7 @@ bool ASTDump::preVisit(AST *ast)
char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr); char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr);
id = cppId; id = cppId;
#endif #endif
out << QByteArray(_depth, ' ') << id << endl; out << QByteArray(_depth, ' ') << id << Qt::endl;
#ifdef Q_CC_GNU #ifdef Q_CC_GNU
free(cppId); free(cppId);
#endif #endif

View File

@@ -1262,6 +1262,7 @@ OutputIterator set_union(InputIterator1 first1,
// Replacement for deprecated Qt functionality // Replacement for deprecated Qt functionality
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
template <class T> template <class T>
QSet<T> toSet(const QList<T> &list) QSet<T> toSet(const QList<T> &list)
{ {
@@ -1271,6 +1272,7 @@ QSet<T> toSet(const QList<T> &list)
return QSet<T>(list.begin(), list.end()); return QSet<T>(list.begin(), list.end());
#endif #endif
} }
#endif
template<class T> template<class T>
QSet<T> toSet(const QVector<T> &vec) QSet<T> toSet(const QVector<T> &vec)

View File

@@ -28,8 +28,6 @@
#include <QtGlobal> #include <QtGlobal>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
template<typename Type>
class QList;
class QTreeView; class QTreeView;
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@@ -46,7 +46,7 @@
static QString rectangleToString(const QRect &r) static QString rectangleToString(const QRect &r)
{ {
QString result; QString result;
QTextStream(&result) << r.width() << 'x' << r.height() << forcesign << r.x() << r.y(); QTextStream(&result) << r.width() << 'x' << r.height() << Qt::forcesign << r.x() << r.y();
return result; return result;
} }

View File

@@ -82,8 +82,8 @@ QDebug operator<<(QDebug d, const CompletionEntry &e)
QDebugStateSaver saver(d); QDebugStateSaver saver(d);
d.noquote(); d.noquote();
d.nospace(); d.nospace();
d << "CompletionEntry(\"" << e.text << "\", flags=" << hex d << "CompletionEntry(\"" << e.text << "\", flags=" << Qt::hex
<< showbase << int(e.findFlags) << dec << noshowbase << ')'; << Qt::showbase << int(e.findFlags) << Qt::dec << Qt::noshowbase << ')';
return d; return d;
} }

View File

@@ -28,6 +28,7 @@
#include "core_global.h" #include "core_global.h"
#include "id.h" #include "id.h"
#include <QList>
#include <QMainWindow> #include <QMainWindow>
#include <QObject> #include <QObject>
#include <QRect> #include <QRect>
@@ -39,7 +40,6 @@ QT_BEGIN_NAMESPACE
class QPrinter; class QPrinter;
class QStatusBar; class QStatusBar;
class QWidget; class QWidget;
template <typename T> class QList;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {

View File

@@ -27,6 +27,7 @@
#include <coreplugin/inavigationwidgetfactory.h> #include <coreplugin/inavigationwidgetfactory.h>
#include <QList>
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
#include <QStackedWidget> #include <QStackedWidget>
@@ -37,7 +38,6 @@ class QLabel;
class QModelIndex; class QModelIndex;
class QStackedLayout; class QStackedLayout;
class QStandardItem; class QStandardItem;
template <class> class QList;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace TextEditor { class TextEditorLinkLabel; } namespace TextEditor { class TextEditorLinkLabel; }

View File

@@ -25,7 +25,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QList>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QString; class QString;

View File

@@ -27,9 +27,7 @@
#include "cpptools_global.h" #include "cpptools_global.h"
QT_BEGIN_NAMESPACE #include <QList>
template <class> class QList;
QT_END_NAMESPACE
namespace CPlusPlus { namespace CPlusPlus {
class Class; class Class;

View File

@@ -92,8 +92,10 @@ QString StringTablePrivate::insert(const QString &string)
if (string.isEmpty()) if (string.isEmpty())
return string; return string;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#ifndef QT_NO_UNSHARABLE_CONTAINERS #ifndef QT_NO_UNSHARABLE_CONTAINERS
QTC_ASSERT(const_cast<QString&>(string).data_ptr()->ref.isSharable(), return string); QTC_ASSERT(const_cast<QString&>(string).data_ptr()->ref.isSharable(), return string);
#endif
#endif #endif
m_stopGCRequested.fetchAndStoreAcquire(true); m_stopGCRequested.fetchAndStoreAcquire(true);

View File

@@ -150,10 +150,10 @@ bool AuthenticationDialog::setupCredentials()
replaceEntry(line, "login", user); replaceEntry(line, "login", user);
replaceEntry(line, "password", password); replaceEntry(line, "password", password);
} }
out << line << endl; out << line << Qt::endl;
} }
if (!found) if (!found)
out << "machine " << m_server->host << " login " << user << " password " << password << endl; out << "machine " << m_server->host << " login " << user << " password " << password << Qt::endl;
Utils::FileSaver saver(m_netrcFileName, QFile::WriteOnly | QFile::Truncate | QFile::Text); Utils::FileSaver saver(m_netrcFileName, QFile::WriteOnly | QFile::Truncate | QFile::Text);
saver.write(netrcContents.toUtf8()); saver.write(netrcContents.toUtf8());
return saver.finalize(); return saver.finalize();

View File

@@ -55,6 +55,8 @@ enum { debug = 0 };
using namespace VcsBase; using namespace VcsBase;
using namespace Qt;
namespace Gerrit { namespace Gerrit {
namespace Internal { namespace Internal {

View File

@@ -458,9 +458,17 @@ void TextBrowserHelpWidget::resizeEvent(QResizeEvent *e)
scrollToTextPosition(topTextPosition); scrollToTextPosition(topTextPosition);
} }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void TextBrowserHelpWidget::setSource(const QUrl &name) void TextBrowserHelpWidget::setSource(const QUrl &name)
#else
void TextBrowserHelpWidget::doSetSource(const QUrl &name, QTextDocument::ResourceType type)
#endif
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QTextBrowser::setSource(name); QTextBrowser::setSource(name);
#else
QTextBrowser::doSetSource(name, type);
#endif
QTextCursor cursor(document()); QTextCursor cursor(document());
while (!cursor.atEnd()) { while (!cursor.atEnd()) {

View File

@@ -92,7 +92,11 @@ public:
void scaleUp(); void scaleUp();
void scaleDown(); void scaleDown();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void setSource(const QUrl &name) override; void setSource(const QUrl &name) override;
#else
void doSetSource(const QUrl &url, QTextDocument::ResourceType type) override;
#endif
void withFixedTopPosition(const std::function<void()> &action); void withFixedTopPosition(const std::function<void()> &action);

View File

@@ -140,13 +140,13 @@ void NimBuildSystem::updateProject()
// Sync watched dirs // Sync watched dirs
const QSet<QString> fsDirs = Utils::transform<QSet>(nodes, &FileNode::directory); const QSet<QString> fsDirs = Utils::transform<QSet>(nodes, &FileNode::directory);
const QSet<QString> projectDirs = m_directoryWatcher.directories().toSet(); const QSet<QString> projectDirs = Utils::toSet(m_directoryWatcher.directories());
m_directoryWatcher.addDirectories(Utils::toList(fsDirs - projectDirs), FileSystemWatcher::WatchAllChanges); m_directoryWatcher.addDirectories(Utils::toList(fsDirs - projectDirs), FileSystemWatcher::WatchAllChanges);
m_directoryWatcher.removeDirectories(Utils::toList(projectDirs - fsDirs)); m_directoryWatcher.removeDirectories(Utils::toList(projectDirs - fsDirs));
// Sync project files // Sync project files
const QSet<FilePath> fsFiles = Utils::transform<QSet>(nodes, &FileNode::filePath); const QSet<FilePath> fsFiles = Utils::transform<QSet>(nodes, &FileNode::filePath);
const QSet<FilePath> projectFiles = project()->files([](const Node *n) { return Project::AllFiles(n); }).toSet(); const QSet<FilePath> projectFiles = Utils::toSet(project()->files([](const Node *n) { return Project::AllFiles(n); }));
if (fsFiles != projectFiles) { if (fsFiles != projectFiles) {
auto projectNode = std::make_unique<ProjectNode>(project()->projectDirectory()); auto projectNode = std::make_unique<ProjectNode>(project()->projectDirectory());

View File

@@ -101,6 +101,8 @@ using namespace QmlJS::AST;
using namespace QmlJSTools; using namespace QmlJSTools;
using namespace TextEditor; using namespace TextEditor;
using namespace Qt;
namespace QmlJSEditor { namespace QmlJSEditor {
// //

View File

@@ -32,10 +32,6 @@
#include <QColor> #include <QColor>
#include <QCoreApplication> #include <QCoreApplication>
QT_BEGIN_NAMESPACE
template <class> class QList;
QT_END_NAMESPACE
namespace QmlJS { namespace QmlJS {
class ScopeChain; class ScopeChain;
class Context; class Context;

View File

@@ -54,7 +54,7 @@ public:
this->state = state; this->state = state;
} }
bool operator ==(const ConfigState& cs) bool operator ==(const ConfigState &cs) const
{ {
return config == cs.config && state == cs.state; return config == cs.config && state == cs.state;
} }

View File

@@ -27,10 +27,6 @@
#include "texteditoroptionspage.h" #include "texteditoroptionspage.h"
QT_BEGIN_NAMESPACE
template <class> class QList;
QT_END_NAMESPACE
namespace TextEditor { namespace TextEditor {
class HighlighterSettings; class HighlighterSettings;

View File

@@ -41,12 +41,12 @@ bool Keyword::equals(const Keyword &other) const
&& (this->color == other.color); && (this->color == other.color);
} }
bool operator ==(Keyword &k1, Keyword &k2) bool operator ==(const Keyword &k1, const Keyword &k2)
{ {
return k1.equals(k2); return k1.equals(k2);
} }
bool operator !=(Keyword &k1, Keyword &k2) bool operator !=(const Keyword &k1, const Keyword &k2)
{ {
return !k1.equals(k2); return !k1.equals(k2);
} }

View File

@@ -49,8 +49,8 @@ public:
using KeywordList = QList<Keyword>; using KeywordList = QList<Keyword>;
bool operator ==(Keyword &k1, Keyword &k2); bool operator ==(const Keyword &k1, const Keyword &k2);
bool operator !=(Keyword &k1, Keyword &k2); bool operator !=(const Keyword &k1, const Keyword &k2);
} // namespace Internal } // namespace Internal
} // namespace Todo } // namespace Todo

View File

@@ -138,12 +138,12 @@ bool Settings::equals(const Settings &other) const
&& (keywordsEdited == other.keywordsEdited); && (keywordsEdited == other.keywordsEdited);
} }
bool operator ==(Settings &s1, Settings &s2) bool operator ==(const Settings &s1, const Settings &s2)
{ {
return s1.equals(s2); return s1.equals(s2);
} }
bool operator !=(Settings &s1, Settings &s2) bool operator !=(const Settings &s1, const Settings &s2)
{ {
return !s1.equals(s2); return !s1.equals(s2);
} }

View File

@@ -52,8 +52,8 @@ public:
bool equals(const Settings &other) const; bool equals(const Settings &other) const;
}; };
bool operator ==(Settings &s1, Settings &s2); bool operator ==(const Settings &s1, const Settings &s2);
bool operator !=(Settings &s1, Settings &s2); bool operator !=(const Settings &s1, const Settings &s2);
} // namespace Internal } // namespace Internal
} // namespace Todo } // namespace Todo

View File

@@ -86,5 +86,5 @@ void CompilerOutputProcessor::handleTask(const ProjectExplorer::Task &task)
*m_ostream << ':' << task.line; *m_ostream << ':' << task.line;
*m_ostream << ": "; *m_ostream << ": ";
} }
*m_ostream << task.description << endl; *m_ostream << task.description << Qt::endl;
} }

View File

@@ -36,6 +36,8 @@
using namespace Valgrind::Fake; using namespace Valgrind::Fake;
using namespace Qt;
QTextStream qerr(stderr); QTextStream qerr(stderr);
QTextStream qout(stdout); QTextStream qout(stdout);

View File

@@ -115,7 +115,7 @@ void OutputGenerator::produceRuntimeError()
blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre"); blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre");
m_output->flush(); m_output->flush();
} else if (m_wait) { } else if (m_wait) {
qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << endl; qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << Qt::endl;
doSleep(1000 * m_wait); doSleep(1000 * m_wait);
} }
} }