Commit 1d5091e4 authored by Christian Kandeler's avatar Christian Kandeler

Do not use deprecated Qt functionality.

Replace all* remaining deprecated Qt 4 functions with
their Qt 5 counterparts. This means we no longer need to
define the QT_DISABLE_DEPRECATED_BEFORE macro.
This patch is relatively small because most source-compatible
changes of this kind have been done before.

* The one exception is the QmlDesigner, which uses QWeakPointer
in a deprecated way all over the place.

Change-Id: Id4b839c6685f3b5bdf2b89137f95231758ec53c7
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 7ba0f8a4
......@@ -149,7 +149,6 @@ win32-msvc* {
qt {
contains(QT, core): QT += concurrent
contains(QT, gui): QT += widgets
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900
}
QBSFILE = $$replace(_PRO_FILE_, \\.pro$, .qbs)
......
......@@ -50,7 +50,6 @@ Project {
property stringList generalDefines: [
"QT_CREATOR",
'IDE_LIBRARY_BASENAME="' + libDirName + '"',
"QT_DISABLE_DEPRECATED_BEFORE=0x040900",
"QT_NO_CAST_TO_ASCII",
"QT_NO_CAST_FROM_ASCII"
].concat(testsEnabled ? ["WITH_TESTS"] : [])
......
......@@ -21,6 +21,7 @@ include (../types/types.pri)
SOURCES += $$PWD/qmlpuppetmain.cpp
RESOURCES += $$PWD/../qmlpuppet.qrc
DEFINES -= QT_NO_CAST_FROM_ASCII
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900 # For deprecated QWeakPointer use.
unix:!macx:LIBS += -lrt # posix shared memory
......
......@@ -7,8 +7,4 @@ build_all:!build_pass {
CONFIG += release
}
greaterThan(QT_MAJOR_VERSION, 4) {
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900
}
include(qmlpuppet.pri)
......@@ -53,8 +53,8 @@
#include <QNetworkProxyFactory>
#include <QApplication>
#include <QDesktopServices>
#include <QMessageBox>
#include <QStandardPaths>
#ifdef ENABLE_QT_BREAKPAD
#include <qtsystemexceptionhandler.h>
......@@ -214,7 +214,8 @@ static inline QStringList getPluginPaths()
// "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
// "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
// "~/Library/Application Support/QtProject/Qt Creator" on Mac
pluginPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
pluginPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QLatin1String("/data");
pluginPath += QLatin1Char('/')
+ QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR)
+ QLatin1Char('/');
......@@ -297,11 +298,6 @@ int main(int argc, char **argv)
setrlimit(RLIMIT_NOFILE, &rl);
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// QML is unusable with the xlib backend
QApplication::setGraphicsSystem(QLatin1String("raster"));
#endif
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
......
......@@ -101,8 +101,8 @@ PluginView::PluginView(QWidget *parent)
gridLayout->addWidget(m_categoryWidget, 1, 0, 1, 1);
QHeaderView *header = m_categoryWidget->header();
header->setResizeMode(0, QHeaderView::ResizeToContents);
header->setResizeMode(2, QHeaderView::ResizeToContents);
header->setSectionResizeMode(0, QHeaderView::ResizeToContents);
header->setSectionResizeMode(2, QHeaderView::ResizeToContents);
m_okIcon = QIcon(QLatin1String(":/extensionsystem/images/ok.png"));
m_errorIcon = QIcon(QLatin1String(":/extensionsystem/images/error.png"));
......
......@@ -36,8 +36,8 @@
#include <QFileDialog>
#include <QFileInfo>
#include <QApplication>
#include <QDesktopServices>
#include <QMessageBox>
#include <QStandardPaths>
namespace QSsh {
......@@ -51,7 +51,7 @@ SshKeyCreationDialog::SshKeyCreationDialog(QWidget *parent)
#else
m_ui->privateKeyFileButton->setText(tr("Browse..."));
#endif
const QString defaultPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
const QString defaultPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ QLatin1String("/.ssh/qtc_id");
setPrivateKeyFile(defaultPath);
......
......@@ -247,7 +247,7 @@ BaseTreeView::BaseTreeView(QWidget *parent)
QHeaderView *h = header();
h->setDefaultAlignment(Qt::AlignLeft);
h->setClickable(true);
h->setSectionsClickable(true);
h->viewport()->installEventFilter(d);
connect(this, SIGNAL(activated(QModelIndex)),
......
......@@ -32,7 +32,7 @@
#include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QTextDocument> // Qt::escape() in Qt 4
#include <QString>
#include <QFont>
namespace Utils {
......@@ -151,7 +151,7 @@ QVariant EnvironmentModel::data(const QModelIndex &index, int role) const
QString value = d->m_resultEnvironment.value(d->m_resultEnvironment.constBegin() + index.row());
if (role == Qt::ToolTipRole && value.length() > 80) {
// Use html to enable text wrapping
value = Qt::escape(value);
value = value.toHtmlEscaped();
value.prepend(QLatin1String("<html><body>"));
value.append(QLatin1String("</body></html>"));
}
......
......@@ -42,16 +42,14 @@ static inline QString msgCanceled(const QString &searchTerm, int numMatches, int
{
return QCoreApplication::translate("Utils::FileSearch",
"%1: canceled. %n occurrences found in %2 files.",
0, QCoreApplication::CodecForTr, numMatches).
arg(searchTerm).arg(numFilesSearched);
0, numMatches).arg(searchTerm).arg(numFilesSearched);
}
static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched)
{
return QCoreApplication::translate("Utils::FileSearch",
"%1: %n occurrences found in %2 files.",
0, QCoreApplication::CodecForTr, numMatches).
arg(searchTerm).arg(numFilesSearched);
0, numMatches).arg(searchTerm).arg(numFilesSearched);
}
namespace {
......
......@@ -58,14 +58,15 @@ bool HeaderViewStretcher::eventFilter(QObject *obj, QEvent *ev)
if (ev->type() == QEvent::Show) {
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
for (int i = 0; i < hv->count(); ++i)
hv->setResizeMode(i, QHeaderView::Interactive);
hv->setSectionResizeMode(i, QHeaderView::Interactive);
} else if (ev->type() == QEvent::Hide) {
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
for (int i = 0; i < hv->count(); ++i)
hv->setResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
hv->setSectionResizeMode(i, i == m_columnToStretch
? QHeaderView::Stretch : QHeaderView::ResizeToContents);
} else if (ev->type() == QEvent::Resize) {
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
if (hv->resizeMode(m_columnToStretch) == QHeaderView::Interactive) {
if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive) {
QResizeEvent *re = static_cast<QResizeEvent*>(ev);
int diff = re->size().width() - re->oldSize().width() ;
hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(m_columnToStretch) + diff));
......
......@@ -60,7 +60,7 @@ NavigationTreeView::NavigationTreeView(QWidget *parent)
setHeaderHidden(true);
// We let the column adjust to contents, but note
// the setting of a minimum size in resizeEvent()
header()->setResizeMode(QHeaderView::ResizeToContents);
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
header()->setStretchLastSection(false);
}
......
......@@ -37,10 +37,10 @@
#include "hostosinfo.h"
#include <QDebug>
#include <QDesktopServices>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPushButton>
#include <QStandardPaths>
/*!
\class Utils::PathChooser
......@@ -594,7 +594,7 @@ QString PathChooser::homePath()
// does not let people actually display the contents of their home
// directory. Alternatively, create a QtCreator-specific directory?
if (HostOsInfo::isWindowsHost())
return QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
return QDir::homePath();
}
......
......@@ -169,8 +169,8 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
m_ui->CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation());
m_ui->AVDTableView->setModel(&m_AVDModel);
m_AVDModel.setAvdList(m_androidConfig.androidVirtualDevices());
m_ui->AVDTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
m_ui->AVDTableView->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
m_ui->AVDTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
m_ui->AVDTableView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
m_ui->downloadAntToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
m_ui->downloadOpenJDKToolButton->setVisible(!Utils::HostOsInfo::isLinuxHost());
......
......@@ -207,7 +207,7 @@ void ArtisticStyleSettings::createDocumentationFile() const
const QString text = QLatin1String("<p><span class=\"option\">")
+ keys.filter(QRegExp(QLatin1String("^\\-"))).join(QLatin1String(", "))
+ QLatin1String("</span></p><p>")
+ Qt::escape(docu.join(QLatin1Char(' ')))
+ (docu.join(QLatin1Char(' ')).toHtmlEscaped())
+ QLatin1String("</p>");
stream.writeTextElement(QLatin1String(Constants::DOCUMENTATION_XMLDOC), text);
stream.writeEndElement();
......
......@@ -153,7 +153,7 @@ void UncrustifySettings::createDocumentationFile() const
const QString text = QLatin1String("<p><span class=\"option\">") + keyword
+ QLatin1String("</span> <span class=\"param\">") + options
+ QLatin1String("</span></p><p>")
+ Qt::escape(docu.join(QLatin1Char(' ')))
+ (docu.join(QLatin1Char(' ')).toHtmlEscaped())
+ QLatin1String("</p>");
stream.writeStartElement(QLatin1String(Constants::DOCUMENTATION_XMLENTRY));
stream.writeTextElement(QLatin1String(Constants::DOCUMENTATION_XMLKEY), keyword);
......
......@@ -311,11 +311,11 @@ QString ClangFunctionHintModel::text(int index) const
const int end = overview.markedArgumentEnd();
QString hintText;
hintText += Qt::escape(prettyMethod.left(begin));
hintText += prettyMethod.left(begin).toHtmlEscaped());
hintText += "<b>";
hintText += Qt::escape(prettyMethod.mid(begin, end - begin));
hintText += prettyMethod.mid(begin, end - begin).toHtmlEscaped());
hintText += "</b>";
hintText += Qt::escape(prettyMethod.mid(end));
hintText += prettyMethod.mid(end).toHtmlEscaped());
return hintText;
#endif
return m_functionSymbols.at(index).hint();
......
......@@ -91,7 +91,7 @@ void CompletionProposalsBuilder::operator ()(const CXCompletionResult &cxResult)
#if defined(CINDEX_VERSION) && (CINDEX_VERSION > 5)
const QString brief = Internal::getQString(clang_getCompletionBriefComment(cxResult.CompletionString));
if (!brief.isEmpty())
m_comment += QLatin1String("<b>Brief:</b> ") + Qt::escape(brief);
m_comment += (QLatin1String("<b>Brief:</b> ") + brief).toHtmlEscaped();
#endif
if (m_resultAvailability == CodeCompletionResult::Deprecated) {
......@@ -384,12 +384,12 @@ void CompletionProposalsBuilder::concatChunksForObjectiveCMessage(const CXComple
const QString text = Internal::getQString(clang_getCompletionChunkText(cxString, index), false);
if (chunkKind == CXCompletionChunk_ResultType) {
hintPrefix += QLatin1String("(");
hintPrefix += Qt::escape(text);
hintPrefix += text.toHtmlEscaped();
hintPrefix += QLatin1String(") ");
indentBonus += 3 + text.length();
addSpaceAtPrefixEnd = false;
} else {
hintPrefix += Qt::escape(text);
hintPrefix += text.toHtmlEscaped();
indentBonus += text.length();
m_snippet += text;
}
......@@ -426,12 +426,12 @@ void CompletionProposalsBuilder::concatChunksForObjectiveCMessage(const CXComple
case CXCompletionChunk_Comma:
case CXCompletionChunk_HorizontalSpace:
m_snippet += text;
parts.back().text += Qt::escape(text);
parts.back().text += text.toHtmlEscaped();
break;
case CXCompletionChunk_Placeholder:
appendSnippet(text);
parts.back().text += QLatin1String("<b>");
parts.back().text += Qt::escape(text);
parts.back().text += text.toHtmlEscaped();
parts.back().text += QLatin1String("</b>");
break;
case CXCompletionChunk_LeftAngle:
......@@ -487,7 +487,7 @@ void CompletionProposalsBuilder::concatChunksForNestedName(const CXCompletionStr
case CXCompletionChunk_Comma:
case CXCompletionChunk_HorizontalSpace:
m_snippet += text;
m_hint += Qt::escape(text);
m_hint += text.toHtmlEscaped();
break;
case CXCompletionChunk_Placeholder:
......@@ -575,7 +575,7 @@ void CompletionProposalsBuilder::concatChunksOnlyTypedText(const CXCompletionStr
case CXCompletionChunk_Text:
case CXCompletionChunk_LeftAngle:
case CXCompletionChunk_RightAngle:
m_hint += Qt::escape(text);
m_hint += text.toHtmlEscaped();
break;
case CXCompletionChunk_HorizontalSpace:
......@@ -583,14 +583,14 @@ void CompletionProposalsBuilder::concatChunksOnlyTypedText(const CXCompletionStr
if (isInsideTemplateSpec) {
m_snippet += text;
}
m_hint += Qt::escape(text);
m_hint += text.toHtmlEscaped();
break;
case CXCompletionChunk_Placeholder:
if (isInsideTemplateSpec) {
appendSnippet(text);
}
m_hint += Qt::escape(text);
m_hint += text.toHtmlEscaped();
break;
case CXCompletionChunk_TypedText:
......@@ -599,7 +599,7 @@ void CompletionProposalsBuilder::concatChunksOnlyTypedText(const CXCompletionStr
break;
case CXCompletionChunk_ResultType: {
m_hint += Qt::escape(text);
m_hint += text.toHtmlEscaped();
QChar last = text[text.size() - 1];
if (last != QLatin1Char('*') && last != QLatin1Char('&'))
m_hint += QLatin1Char(' ');
......@@ -698,7 +698,7 @@ void CompletionProposalsBuilder::appendOptionalChunks(const CXCompletionString &
switch (chunkKind) {
case CXCompletionChunk_Placeholder:
chunk.hint += Qt::escape(text);
chunk.hint += text.toHtmlEscaped();
break;
case CXCompletionChunk_Comma:
......@@ -742,7 +742,7 @@ void CompletionProposalsBuilder::appendSnippet(const QString &text)
void CompletionProposalsBuilder::appendHintBold(const QString &text)
{
m_hint += QLatin1String("<b>");
m_hint += Qt::escape(text);
m_hint += text.toHtmlEscaped();
m_hint += QLatin1String("</b>");
}
......
......@@ -187,10 +187,10 @@ void ClangCodeModelPlugin::test_CXX_snippets()
if (ccr.text() != text)
continue;
hasText = true;
QVERIFY2(snippet == ccr.snippet(), snippetError.arg(ccr.snippet()).toAscii());
QVERIFY2(snippet == ccr.snippet(), snippetError.arg(ccr.snippet()).toLatin1());
}
const QString textError(QLatin1String("Text not found:") + text);
QVERIFY2(hasText, textError.toAscii());
QVERIFY2(hasText, textError.toLatin1());
}
}
......@@ -298,12 +298,12 @@ void ClangCodeModelPlugin::test_ObjC_hints()
if (ccr.text() != text)
continue;
hasText = true;
QVERIFY2(snippet == ccr.snippet(), snippetError.arg(ccr.snippet()).toAscii());
QVERIFY2(hint == ccr.hint(), hintError.arg(ccr.hint()).toAscii());
QVERIFY2(snippet == ccr.snippet(), snippetError.arg(ccr.snippet()).toLatin1());
QVERIFY2(hint == ccr.hint(), hintError.arg(ccr.hint()).toLatin1());
}
const QString textError(QString::fromLatin1("Text \"%1\" not found in set %2")
.arg(text).arg(texts.join(QLatin1Char(','))));
QVERIFY2(hasText, textError.toAscii());
QVERIFY2(hasText, textError.toLatin1());
}
}
......
......@@ -209,7 +209,7 @@ void CMakeTool::parseFunctionOutput(const QByteArray &output)
QString CMakeTool::formatFunctionDetails(const QString &command, const QString &args)
{
return QString::fromLatin1("<table><tr><td><b>%1</b></td><td>%2</td></tr>")
.arg(Qt::escape(command)).arg(Qt::escape(args));
.arg(command.toHtmlEscaped(), args.toHtmlEscaped());
}
void CMakeTool::parseFunctionDetailsOutput(const QByteArray &output)
......@@ -250,7 +250,7 @@ void CMakeTool::parseFunctionDetailsOutput(const QByteArray &output)
} else {
extractKeywords(lineTrimmed, &m_variables);
currentCommandSyntax += QString::fromLatin1("<tr><td>&nbsp;</td><td>%1</td></tr>")
.arg(Qt::escape(QString::fromLocal8Bit(lineTrimmed)));
.arg(QString::fromLocal8Bit(lineTrimmed).toHtmlEscaped());
}
}
}
......
......@@ -57,7 +57,6 @@ static const Qt::ItemFlags TOOL_ITEM_FLAGS = Qt::ItemIsSelectable | Qt::ItemIsEn
ExternalToolModel::ExternalToolModel(QObject *parent)
: QAbstractItemModel(parent)
{
setSupportedDragActions(Qt::MoveAction);
}
ExternalToolModel::~ExternalToolModel()
......
......@@ -103,8 +103,8 @@ OpenEditorsWidget::OpenEditorsWidget()
setSelectionBehavior(QAbstractItemView::SelectRows);
setActivationMode(Utils::SingleClickActivation);
header()->setStretchLastSection(false);
header()->setResizeMode(0, QHeaderView::Stretch);
header()->setResizeMode(1, QHeaderView::Fixed);
header()->setSectionResizeMode(0, QHeaderView::Stretch);
header()->setSectionResizeMode(1, QHeaderView::Fixed);
header()->resizeSection(1, 16);
setContextMenuPolicy(Qt::CustomContextMenu);
installEventFilter(this);
......
......@@ -316,7 +316,7 @@ static void localizedText(const QStringList &locales, QXmlStreamReader *reader,
if (*currentLocale < 0 && currentText->isEmpty()) {
*currentText = QCoreApplication::translate("Core::Internal::ExternalTool",
reader->readElementText().toUtf8().constData(),
"", QCoreApplication::UnicodeUTF8);
"");
} else {
reader->skipCurrentElement();
}
......
......@@ -198,7 +198,7 @@ CompletionList::CompletionList(QWidget *parent)
header()->hide();
header()->setStretchLastSection(true);
// This is too slow when done on all results
//header()->setResizeMode(QHeaderView::ResizeToContents);
//header()->setSectionResizeMode(QHeaderView::ResizeToContents);
setWindowFlags(Qt::ToolTip);
if (Utils::HostOsInfo::isMacHost()) {
if (horizontalScrollBar())
......
......@@ -99,7 +99,7 @@ void CppHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
void CppHoverHandler::decorateToolTip()
{
if (Qt::mightBeRichText(toolTip()))
setToolTip(Qt::escape(toolTip()));
setToolTip(toolTip().toHtmlEscaped());
if (isDiagnosticTooltip())
return;
......
......@@ -375,11 +375,11 @@ QString CppFunctionHintModel::text(int index) const
const int end = overview.markedArgumentEnd;
QString hintText;
hintText += Qt::escape(prettyMethod.left(begin));
hintText += prettyMethod.left(begin).toHtmlEscaped();
hintText += QLatin1String("<b>");
hintText += Qt::escape(prettyMethod.mid(begin, end - begin));
hintText += prettyMethod.mid(begin, end - begin).toHtmlEscaped();
hintText += QLatin1String("</b>");
hintText += Qt::escape(prettyMethod.mid(end));
hintText += prettyMethod.mid(end).toHtmlEscaped();
return hintText;
}
......
......@@ -249,9 +249,9 @@ QWidget *DebuggerOptionsPage::widget()
QHeaderView *header = m_debuggerView->header();
header->setStretchLastSection(false);
header->setResizeMode(0, QHeaderView::ResizeToContents);
header->setResizeMode(1, QHeaderView::ResizeToContents);
header->setResizeMode(2, QHeaderView::Stretch);
header->setSectionResizeMode(0, QHeaderView::ResizeToContents);
header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
header->setSectionResizeMode(2, QHeaderView::Stretch);
QVBoxLayout *buttonLayout = new QVBoxLayout();
buttonLayout->setSpacing(6);
......
......@@ -444,9 +444,9 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
QString msg = stackFrames.isEmpty()
? tr("<p>An uncaught exception occurred:</p><p>%1</p>")
.arg(Qt::escape(error))
.arg(error.toHtmlEscaped())
: tr("<p>An uncaught exception occurred in \"%1\":</p><p>%2</p>")
.arg(QLatin1String(stackFrames.value(0).fileUrl), Qt::escape(error));
.arg(QLatin1String(stackFrames.value(0).fileUrl), error.toHtmlEscaped());
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg);
} else {
QString file;
......
......@@ -118,7 +118,7 @@ void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFile
void SourceFilesHandler::removeAll()
{
setSourceFiles(QMap<QString, QString>());
//header()->setResizeMode(0, QHeaderView::ResizeToContents);
//header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
}
} // namespace Internal
......
......@@ -341,36 +341,11 @@ QString WatchData::toString() const
return res + QLatin1Char('}');
}
static QString htmlEscape(const QString &plain)
{
#if QT_VERSION >= 0x050000
return Qt::escape(plain);
#else
// Copied from Qt to avoid GUI dependency
// (Qt::escape has been moved in Qt 5)
QString rich;
rich.reserve(int(plain.length() * qreal(1.1)));
for (int i = 0; i < plain.length(); ++i) {
if (plain.at(i) == QLatin1Char('<'))
rich += QLatin1String("&lt;");
else if (plain.at(i) == QLatin1Char('>'))
rich += QLatin1String("&gt;");
else if (plain.at(i) == QLatin1Char('&'))
rich += QLatin1String("&amp;");
else if (plain.at(i) == QLatin1Char('"'))
rich += QLatin1String("&quot;");
else
rich += plain.at(i);
}
return rich;
#endif
}
// Format a tooltip fow with aligned colon.
static void formatToolTipRow(QTextStream &str,
const QString &category, const QString &value)
{
QString val = htmlEscape(value);
QString val = value.toHtmlEscaped();
val.replace(QLatin1Char('\n'), QLatin1String("<br>"));
str << "<tr><td>" << category << "</td><td> : </td><td>"
<< val << "</td></tr>";
......
......@@ -51,6 +51,7 @@
#include <QTabWidget>
#include <QTextEdit>
#include <cstring>
#include <ctype.h>
//#define USE_WATCH_MODEL_TEST 0
......@@ -1845,7 +1846,7 @@ void WatchHandler::showEditValue(const WatchData &data)
QTC_ASSERT(0 < nbytes && nbytes < 10000 * 10000, return);
QTC_ASSERT(0 < format && format < 32, return);
QImage im(width, height, QImage::Format(format));
qMemCopy(im.bits(), bits, nbytes);
std::memcpy(im.bits(), bits, nbytes);
const QString title = data.address ?
tr("%1 Object at %2").arg(QLatin1String(data.type),
QLatin1String(data.hexAddress())) :
......
......@@ -97,10 +97,10 @@
#include <QStackedWidget>
#include <QTextStream>
#include <QDesktopServices>
#include <QItemDelegate>
#include <QPlainTextEdit>
#include <QShortcut>
#include <QStandardPaths>
#include <QTextBlock>
#include <QTextCursor>
#include <QTextEdit>
......@@ -1379,7 +1379,7 @@ void FakeVimPluginPrivate::maybeReadVimRc()
return;
QString fileName = theFakeVimSetting(ConfigVimRcPath)->value().toString();
if (fileName.isEmpty()) {
fileName = QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
fileName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
+ (Utils::HostOsInfo::isWindowsHost() ? _("/_vimrc") : _("/.vimrc"));
}
//qDebug() << "READING VIMRC: " << fileName;
......
......@@ -34,6 +34,7 @@
#include <QSettings>
#include <QNetworkReply>
#include <QUrlQuery>
#include <utils/qtcassert.h>
#include <utils/networkaccessmanager.h>
......@@ -544,9 +545,11 @@ void Gitorious::updateProjectList(int hostIndex)
void Gitorious::startProjectsRequest(int hostIndex, int page)
{
QUrl url = httpRequest(hostName(hostIndex), QLatin1String("projects"));
url.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
QUrlQuery query;
query.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
if (page >= 0)
url.addQueryItem(QLatin1String("page"), QString::number(page));
query.addQueryItem(QLatin1String("page"), QString::number(page));
url.setQuery(query);
createRequest