diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-12-12 09:44:13 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-12-12 09:44:13 +0100 |
commit | 9084ca73dff77d3df8ce564a19016dfeb482ea6d (patch) | |
tree | d2adbbe2b307fd51c9dd347cc5cd4be7f9fe9203 | |
parent | 1a2a278eec7a8438006246f47932d614804e3894 (diff) | |
parent | 5cd4a73acab1ee3782747d5de55c0ae734bfba2f (diff) | |
download | qt-creator-9084ca73dff77d3df8ce564a19016dfeb482ea6d.tar.gz |
Merge remote-tracking branch 'origin/4.8'
Conflicts:
qbs/modules/qtc/qtc.qbs
qtcreator.pri
src/plugins/cpptools/compileroptionsbuilder.cpp
Change-Id: I87f47cecbb924064296a002fd9446a0627acad8e
27 files changed, 211 insertions, 137 deletions
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index cdde71b3ff..c6e6adc55f 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -246,17 +246,13 @@ class Dumper(DumperBase): #warn('TARGET TYPE: %s' % targetType) if targetType.code == gdb.TYPE_CODE_ARRAY: val = self.Value(self) - val.laddress = toInteger(nativeValue.address) - val.nativeValue = nativeValue else: # Cast may fail (e.g for arrays, see test for Bug5799) val = self.fromNativeValue(nativeValue.cast(targetType)) - val.type = self.fromNativeType(nativeType) - val.nativeValue = nativeValue #warn('CREATED TYPEDEF: %s' % val) - return val + else: + val = self.Value(self) - val = self.Value(self) val.nativeValue = nativeValue if not nativeValue.address is None: val.laddress = toInteger(nativeValue.address) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 6cccd84fba..6093b94f78 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -2275,3 +2275,10 @@ def __lldb_init_module(debugger, internal_dict): if not __name__ == 'qt': # Make available under global 'qt' name for consistency internal_dict['qt'] = internal_dict[__name__] + + +if __name__ == "lldbbridge": + try: + theDumper = Dumper() + except Exception as error: + print('@\nstate="enginesetupfailed",error="{}"@\n'.format(error)) diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index c2dc93dd48..12099db2d0 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -28666,7 +28666,7 @@ Preselects a desktop Qt for building the application if available.</source> </message> <message> <source>Empty qmake Project</source> - <translation>Пустрой проект qmake</translation> + <translation>Пустой проект qmake</translation> </message> <message> <source>Define Project Details</source> diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp index 8657374f77..fa037ddd61 100644 --- a/src/libs/utils/historycompleter.cpp +++ b/src/libs/utils/historycompleter.cpp @@ -117,8 +117,11 @@ private: if (layoutDirection() == Qt::LeftToRight) rr = viewport()->width() - event->x(); if (rr < clearButtonSize.width()) { - model->removeRow(indexAt(event->pos()).row()); - return; + const QModelIndex index = indexAt(event->pos()); + if (index.isValid()) { + model->removeRow(indexAt(event->pos()).row()); + return; + } } } QListView::mousePressEvent(event); diff --git a/src/libs/utils/textutils.cpp b/src/libs/utils/textutils.cpp index d102de794a..f72dd89321 100644 --- a/src/libs/utils/textutils.cpp +++ b/src/libs/utils/textutils.cpp @@ -142,6 +142,9 @@ QTextCursor wordStartCursor(const QTextCursor &textCursor) int utf8NthLineOffset(const QTextDocument *textDocument, const QByteArray &buffer, int line) { + if (textDocument->blockCount() < line) + return -1; + if (textDocument->characterCount() == buffer.size() + 1) return textDocument->findBlockByNumber(line - 1).position(); diff --git a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp index e8ca9f67ab..5af48386bd 100644 --- a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp +++ b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp @@ -25,6 +25,8 @@ #include "clangcompletionchunkstotextconverter.h" +#include <QtGlobal> + #include <algorithm> #include <functional> @@ -70,6 +72,11 @@ void CompletionChunksToTextConverter::setAddSpaces(bool addSpaces) m_addSpaces = addSpaces; } +void CompletionChunksToTextConverter::setHonorVerticalSpace(bool honor) +{ + m_honorVerticalSpace = honor; +} + void CompletionChunksToTextConverter::setAddExtraVerticalSpaceBetweenBraces( bool addExtraVerticalSpaceBetweenBraces) { @@ -145,6 +152,8 @@ QString CompletionChunksToTextConverter::convertToName( { CompletionChunksToTextConverter converter; + converter.setHonorVerticalSpace(false); + converter.parseChunks(codeCompletionChunks); return converter.text(); @@ -183,6 +192,10 @@ void CompletionChunksToTextConverter::parse( parsePlaceHolder(codeCompletionChunk); break; case CodeCompletionChunk::LeftParen: parseLeftParen(codeCompletionChunk); break; case CodeCompletionChunk::LeftBrace: parseLeftBrace(codeCompletionChunk); break; + case CodeCompletionChunk::VerticalSpace: + if (!m_honorVerticalSpace) + break; + Q_FALLTHROUGH(); default: parseText(codeCompletionChunk.text); break; } } diff --git a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h index 27eccbcf16..88654ed3fd 100644 --- a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h +++ b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h @@ -50,6 +50,7 @@ public: void setAddPlaceHolderPositions(bool addPlaceHolderPositions); void setAddResultType(bool addResultType); void setAddSpaces(bool addSpaces); + void setHonorVerticalSpace(bool honor); void setAddExtraVerticalSpaceBetweenBraces(bool addExtraVerticalSpaceBetweenBraces); void setEmphasizeOptional(bool emphasizeOptional); // Only for Html format void setAddOptional(bool addOptional); @@ -103,6 +104,7 @@ private: bool m_addPlaceHolderPositions = false; bool m_addResultType = false; bool m_addSpaces = false; + bool m_honorVerticalSpace = true; bool m_addExtraVerticalSpaceBetweenBraces = false; bool m_emphasizeOptional = false; bool m_addOptional = false; diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index b70f5ca5bd..51f21cfb83 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -242,40 +242,43 @@ static QString clangIncludeDirectory(const QString &clangVersion, #endif } -static int lastIncludeIndex(const QStringList &options, const QRegularExpression &includePathRegEx) -{ - int index = options.lastIndexOf(includePathRegEx); - - while (index > 0 && options[index - 1] != includeUserPathOption - && options[index - 1] != includeSystemPathOption) { - index = options.lastIndexOf(includePathRegEx, index - 1); - } - - if (index == 0) - index = -1; - - return index; -} - -static int includeIndexForResourceDirectory(const QStringList &options, bool isMacOs = false) +static QStringList insertResourceDirectory(const QStringList &options, + const QString &resourceDir, + bool isMacOs = false) { // include/c++, include/g++, libc++\include and libc++abi\include static const QString cppIncludes = R"((.*[\/\\]include[\/\\].*(g\+\+|c\+\+).*))" R"(|(.*libc\+\+[\/\\]include))" R"(|(.*libc\+\+abi[\/\\]include))"; - static const QRegularExpression includeRegExp("\\A(" + cppIncludes + ")\\z"); - // The same as includeRegExp but also matches /usr/local/include - static const QRegularExpression includeRegExpMac( - "\\A(" + cppIncludes + R"(|([\/\\]usr[\/\\]local[\/\\]include))" + ")\\z"); + QStringList optionsBeforeResourceDirectory; + QStringList optionsAfterResourceDirectory; + QRegularExpression includeRegExp; + if (!isMacOs) { + includeRegExp = QRegularExpression("\\A(" + cppIncludes + ")\\z"); + } else { + // The same as includeRegExp but also matches /usr/local/include + includeRegExp = QRegularExpression( + "\\A(" + cppIncludes + R"(|([\/\\]usr[\/\\]local[\/\\]include))" + ")\\z"); + } - const int cppIncludeIndex = lastIncludeIndex(options, - isMacOs ? includeRegExpMac : includeRegExp); + for (const QString &option : options) { + if (option == includeSystemPathOption) + continue; - if (cppIncludeIndex > 0) - return cppIncludeIndex + 1; + if (includeRegExp.match(option).hasMatch()) { + optionsBeforeResourceDirectory.push_back(includeSystemPathOption); + optionsBeforeResourceDirectory.push_back(option); + } else { + optionsAfterResourceDirectory.push_back(includeSystemPathOption); + optionsAfterResourceDirectory.push_back(option); + } + } - return -1; + optionsBeforeResourceDirectory.push_back(includeSystemPathOption); + optionsBeforeResourceDirectory.push_back(resourceDir); + + return optionsBeforeResourceDirectory + optionsAfterResourceDirectory; } void CompilerOptionsBuilder::insertWrappedQtHeaders() @@ -354,20 +357,13 @@ void CompilerOptionsBuilder::addHeaderPathOptions() // Exclude all built-in includes and Clang resource directory. m_options.prepend("-nostdinc"); - const QString clangIncludePath = clangIncludeDirectory(m_clangVersion, - m_clangResourceDirectory); - const int includeIndexForResourceDir - = includeIndexForResourceDirectory(builtInIncludes, - m_projectPart.toolChainTargetTriple.contains( - "darwin")); + const QString clangIncludePath + = clangIncludeDirectory(m_clangVersion, m_clangResourceDirectory); - if (includeIndexForResourceDir >= 0) { - builtInIncludes.insert(includeIndexForResourceDir, clangIncludePath); - builtInIncludes.insert(includeIndexForResourceDir, includeSystemPathOption); - } else { - builtInIncludes.prepend(clangIncludePath); - builtInIncludes.prepend(includeSystemPathOption); - } + builtInIncludes = insertResourceDirectory(builtInIncludes, + clangIncludePath, + m_projectPart.toolChainTargetTriple.contains( + "darwin")); } m_options.append(builtInIncludes); diff --git a/src/plugins/cpptools/cppcodestylesettings.cpp b/src/plugins/cpptools/cppcodestylesettings.cpp index f634749164..565c969689 100644 --- a/src/plugins/cpptools/cppcodestylesettings.cpp +++ b/src/plugins/cpptools/cppcodestylesettings.cpp @@ -242,7 +242,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentProjectTabSettings() TextEditor::ICodeStylePreferences *codeStylePreferences = editorConfiguration->codeStyle(CppTools::Constants::CPP_SETTINGS_ID); QTC_ASSERT(codeStylePreferences, return currentGlobalTabSettings()); - return codeStylePreferences->tabSettings(); + return codeStylePreferences->currentTabSettings(); } TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings() @@ -251,7 +251,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings() = CppTools::CppToolsSettings::instance()->cppCodeStyle(); QTC_ASSERT(cppCodeStylePreferences, return TextEditor::TabSettings()); - return cppCodeStylePreferences->tabSettings(); + return cppCodeStylePreferences->currentTabSettings(); } diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index d8975a82dd..2e4b20bf7f 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -418,6 +418,8 @@ public: m_watchHandler.cleanup(); m_engine->showMessage(tr("Debugger finished."), StatusBar); m_engine->setState(DebuggerFinished); // Also destroys views. + if (boolSetting(SwitchModeOnExit)) + EngineManager::deactivateDebugMode(); } void scheduleResetLocation() @@ -2619,7 +2621,10 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp) "experience for this binary format.").arg(preferredDebugger); break; } - if (warnOnRelease && rp.cppEngineType == CdbEngineType) { + if (warnOnRelease + && rp.cppEngineType == CdbEngineType + && rp.startMode != AttachToRemoteServer) { + QTC_ASSERT(!rp.symbolFile.isEmpty(), return); if (!rp.symbolFile.endsWith(".exe", Qt::CaseInsensitive)) rp.symbolFile.append(".exe"); QString errorMessage; diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index a0602851ea..12371975f8 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -26,6 +26,7 @@ #include "debuggermainwindow.h" #include "debuggerconstants.h" #include "debuggerinternalconstants.h" +#include "enginemanager.h" #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actionmanager.h> @@ -696,7 +697,7 @@ void Perspective::addWindow(QWidget *widget, void Perspective::select() { - ModeManager::activateMode(Debugger::Constants::MODE_DEBUG); + Debugger::Internal::EngineManager::activateDebugMode(); if (Perspective::currentPerspective() == this) return; theMainWindow->d->selectPerspective(this); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 4c7fb7a84c..c79cecab50 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -706,7 +706,6 @@ public: void runScheduled(); void attachCore(); - void runControlFinished(DebuggerRunTool *runTool); void remoteCommand(const QStringList &options); void dumpLog(); diff --git a/src/plugins/debugger/enginemanager.cpp b/src/plugins/debugger/enginemanager.cpp index a3c503672a..883668e498 100644 --- a/src/plugins/debugger/enginemanager.cpp +++ b/src/plugins/debugger/enginemanager.cpp @@ -422,6 +422,18 @@ void EngineManager::activateDebugMode() } } +void EngineManager::deactivateDebugMode() +{ + if (ModeManager::currentModeId() == Constants::MODE_DEBUG && d->m_previousMode.isValid()) { + // If stopping the application also makes Qt Creator active (as the + // "previously active application"), doing the switch synchronously + // leads to funny effects with floating dock widgets + const Core::Id mode = d->m_previousMode; + QTimer::singleShot(0, d, [mode]() { ModeManager::activateMode(mode); }); + d->m_previousMode = Id(); + } +} + bool EngineManager::isLastOf(const QString &type) { int count = 0; diff --git a/src/plugins/debugger/enginemanager.h b/src/plugins/debugger/enginemanager.h index a41f13183a..a1ee76c60b 100644 --- a/src/plugins/debugger/enginemanager.h +++ b/src/plugins/debugger/enginemanager.h @@ -49,6 +49,7 @@ public: static void unregisterEngine(DebuggerEngine *engine); static void activateEngine(DebuggerEngine *engine); static void activateDebugMode(); + static void deactivateDebugMode(); static bool isLastOf(const QString &type); static QList<QPointer<DebuggerEngine> > engines(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index c7b34e02ab..3884d3fbf2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2488,15 +2488,17 @@ void GdbEngine::updateBreakpoint(const Breakpoint &bp) QTC_ASSERT(state2 == BreakpointUpdateProceeding, qDebug() << state2); DebuggerCommand cmd; - if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) { - // The only way to change this seems to be to re-set the bp completely. - cmd.function = "-break-delete " + bpnr; - cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); }; - } else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) { - // The only way to change this seems to be to re-set the bp completely. - cmd.function = "-break-delete " + bpnr; - cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; - } else if (requested.command != bp->command()) { + // FIXME: See QTCREATORBUG-21611, QTCREATORBUG-21616 +// if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) { +// // The only way to change this seems to be to re-set the bp completely. +// cmd.function = "-break-delete " + bpnr; +// cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); }; +// } else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) { +// // The only way to change this seems to be to re-set the bp completely. +// cmd.function = "-break-delete " + bpnr; +// cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; +// } else if + if (requested.command != bp->command()) { cmd.function = "-break-commands " + bpnr; for (QString command : requested.command.split('\n')) { if (!command.isEmpty()) { diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 784734cba5..9ace1b0fa4 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -191,6 +191,11 @@ void LldbEngine::abortDebuggerProcess() notifyEngineShutdownFinished(); } +static QString adapterStartFailed() +{ + return LldbEngine::tr("Adapter start failed."); +} + void LldbEngine::setupEngine() { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); @@ -211,7 +216,7 @@ void LldbEngine::setupEngine() notifyEngineSetupFailed(); showMessage("ADAPTER START FAILED"); if (!msg.isEmpty()) - ICore::showWarningWithOptions(tr("Adapter start failed."), msg); + ICore::showWarningWithOptions(adapterStartFailed(), msg); return; } m_lldbProc.waitForReadyRead(1000); @@ -222,9 +227,8 @@ void LldbEngine::setupEngine() ICore::resourcePath().toLocal8Bit() + "/debugger/"; m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n"); + // This triggers reportState("enginesetupok") or "enginesetupfailed": m_lldbProc.write("script from lldbbridge import *\n"); - m_lldbProc.write("script print(dir())\n"); - m_lldbProc.write("script theDumper = Dumper()\n"); // This triggers reportState("enginesetupok") QString commands = nativeStartupCommands(); if (!commands.isEmpty()) @@ -384,7 +388,7 @@ void LldbEngine::handleResponse(const QString &response) cmd.callback(response); } } else if (name == "state") - handleStateNotification(item); + handleStateNotification(all); else if (name == "location") handleLocationNotification(item); else if (name == "output") @@ -830,9 +834,9 @@ void LldbEngine::readLldbStandardOutput() } } -void LldbEngine::handleStateNotification(const GdbMi &reportedState) +void LldbEngine::handleStateNotification(const GdbMi &item) { - QString newState = reportedState.data(); + const QString newState = item["state"].data(); if (newState == "running") notifyInferiorRunOk(); else if (newState == "inferiorrunfailed") @@ -867,9 +871,11 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState) notifyInferiorIll(); else if (newState == "enginesetupok") notifyEngineSetupOk(); - else if (newState == "enginesetupfailed") + else if (newState == "enginesetupfailed") { + Core::AsynchronousMessageBox::critical(adapterStartFailed(), + item["error"].data()); notifyEngineSetupFailed(); - else if (newState == "enginerunfailed") + } else if (newState == "enginerunfailed") notifyEngineRunFailed(); else if (newState == "enginerunandinferiorrunok") { if (runParameters().continueAfterAttach) diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index aff7150055..f06798dd39 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -117,7 +117,7 @@ private: void readLldbStandardOutput(); void readLldbStandardError(); - void handleStateNotification(const GdbMi &state); + void handleStateNotification(const GdbMi &item); void handleLocationNotification(const GdbMi &location); void handleOutputNotification(const GdbMi &output); diff --git a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp index 35ff98710c..8a6defa469 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp @@ -34,6 +34,7 @@ #include <utils/qtcassert.h> +#include <cmath> #include <limits> namespace QmlDesigner { @@ -282,7 +283,7 @@ void QmlTimelineKeyframeGroup::moveAllKeyframes(qreal offset) for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) { auto property = childNode.variantProperty("frame"); if (property.isValid()) - property.setValue(property.value().toReal() + offset); + property.setValue(std::round(property.value().toReal() + offset)); } } @@ -292,7 +293,7 @@ void QmlTimelineKeyframeGroup::scaleAllKeyframes(qreal factor) auto property = childNode.variantProperty("frame"); if (property.isValid()) - property.setValue(property.value().toReal() * factor); + property.setValue(std::round(property.value().toReal() * factor)); } } diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index fbbdaef826..39e85f5031 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -427,7 +427,7 @@ void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaul syncComboWithSettings(d->m_filterCombo, d->m_filterSetting); QStringList exclusionFilters = settings->value("exclusionFilters").toStringList(); - if (exclusionFilters.isEmpty()) + if (!exclusionFilters.contains(defaultExclusionFilter)) exclusionFilters << defaultExclusionFilter; const QVariant currentExclusionFilter = settings->value("currentExclusionFilter"); d->m_exclusionSetting = currentExclusionFilter.isValid() ? currentExclusionFilter.toString() diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp index 41fde3bb26..19c226e326 100644 --- a/src/plugins/texteditor/findinfiles.cpp +++ b/src/plugins/texteditor/findinfiles.cpp @@ -218,7 +218,7 @@ void FindInFiles::writeSettings(QSettings *settings) void FindInFiles::readSettings(QSettings *settings) { settings->beginGroup(QLatin1String("FindInFiles")); - readCommonSettings(settings, "*.cpp,*.h", "*/.git/*,*/.cvs/*,*/.svn/*"); + readCommonSettings(settings, "*.cpp,*.h", "*/.git/*,*/.cvs/*,*/.svn/*,*.autosave"); settings->endGroup(); } diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 9c6667d00c..bc8d8c4d1a 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -406,12 +406,9 @@ bool FontSettings::loadColorScheme(const QString &fileName, if (!m_scheme.contains(id)) { Format format; const Format &descFormat = desc.format(); - if (descFormat == format && m_scheme.contains(C_TEXT)) { - // Default format -> Text - const Format textFormat = m_scheme.formatFor(C_TEXT); - format.setForeground(textFormat.foreground()); - format.setBackground(textFormat.background()); - } else { + // Default fallback for background and foreground is C_TEXT, which is set through + // the editor's palette, i.e. we leave these as invalid colors in that case + if (descFormat != format || !m_scheme.contains(C_TEXT)) { format.setForeground(descFormat.foreground()); format.setBackground(descFormat.background()); } diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 06913efd0f..7f1c63e2f7 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4111,12 +4111,12 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data, if (!blockUserData) return; - TextMarks marks = blockUserData->marks(); - - const bool annotationsVisible = Utils::anyOf(marks, [](const TextMark* mark) { + TextMarks marks = Utils::filtered(blockUserData->marks(), [](const TextMark* mark){ return !mark->lineAnnotation().isEmpty(); }); + const bool annotationsVisible = !marks.isEmpty(); + if (updateAnnotationBounds(blockUserData, data.documentLayout, annotationsVisible) || !annotationsVisible) { return; diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index af402f4e8a..817c384f61 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1990,7 +1990,7 @@ void tst_Dumpers::dumper_data() + CoreProfile() + Check("f1", "a (1)", TypeDef("QFlags<enum Foo>", "FooFlags")) % CdbEngine + Check("f1", "a (0x0001)", "FooFlags") % NoCdbEngine - + Check("f2", "a | b (0x0003)", "FooFlags") % GdbEngine; + + Check("f2", "(a | b) (0x0003)", "FooFlags") % GdbEngine; QTest::newRow("QDateTime") << Data("#include <QDateTime>\n", diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py index 910e4b35c5..99e511049a 100644 --- a/tests/system/suite_editors/tst_memberoperator/test.py +++ b/tests/system/suite_editors/tst_memberoperator/test.py @@ -77,8 +77,9 @@ def main(): proposalToolTips) correction = testData.field(record, "correction") if correction == 'all': - test.compare(len(needCorrection), len(proposalToolTips), - "Verifying whether all proposal need correction.") + __verifyLineUnderCursor__(cppwindow, record) + test.compare(len(needCorrection), 0, + "Verifying whether operator has been already corrected.") elif correction == 'mixed': test.verify(len(proposalToolTips) > len(needCorrection) > 0, "Verifying whether some of the proposals need correction.") diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py index 72943b3eb2..cd9fed32e1 100644 --- a/tests/system/suite_tools/tst_git_local/test.py +++ b/tests/system/suite_tools/tst_git_local/test.py @@ -46,8 +46,9 @@ def commit(commitMessage, expectedLogMessage, uncheckUntracked=False): checkOrFixCommitterInformation('invalidEmailLabel', 'emailLineEdit', 'nobody@nowhere.com') clickButton(waitForObject(":splitter.Commit File(s)_VcsBase::QActionPushButton")) vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}").plainText - test.verify(expectedLogMessage in str(vcsLog), "Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog)) + "window=':Qt Creator_Core::Internal::MainWindow'}") + test.verify(waitFor('expectedLogMessage in str(vcsLog.plainText)', 2000), + "Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog.plainText)) return commitMessage def verifyItemsInGit(commitMessages): diff --git a/tests/unit/unittest/compileroptionsbuilder-test.cpp b/tests/unit/unittest/compileroptionsbuilder-test.cpp index 6b96423051..a2f6212a69 100644 --- a/tests/unit/unittest/compileroptionsbuilder-test.cpp +++ b/tests/unit/unittest/compileroptionsbuilder-test.cpp @@ -236,11 +236,14 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux) TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) { - projectPart.headerPaths = {HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include", HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++", HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32", HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward", HeaderPathType::BuiltIn} - }; + projectPart.headerPaths = { + HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include", HeaderPathType::BuiltIn}, + HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++", + HeaderPathType::BuiltIn}, + HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32", + HeaderPathType::BuiltIn}, + HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward", + HeaderPathType::BuiltIn}}; projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu"; CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::UseSystemHeader::No, @@ -252,33 +255,43 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) compilerOptionsBuilder.addHeaderPathOptions(); - ASSERT_THAT(compilerOptionsBuilder.options(), - ElementsAre("-nostdinc", - "-nostdlibinc", - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include"), - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++"), - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32"), - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward"), - "-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""))); + ASSERT_THAT( + compilerOptionsBuilder.options(), + ElementsAre( + "-nostdinc", + "-nostdlibinc", + "-isystem", + QDir::toNativeSeparators("C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++"), + "-isystem", + QDir::toNativeSeparators( + "C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32"), + "-isystem", + QDir::toNativeSeparators( + "C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward"), + "-isystem", + QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), + "-isystem", + QDir::toNativeSeparators("C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include"))); } TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) { - projectPart.headerPaths = { - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android", - HeaderPathType::BuiltIn}, - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include", - HeaderPathType::BuiltIn}, - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include", - HeaderPathType::BuiltIn}, - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include", - HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include", - HeaderPathType::BuiltIn}}; + projectPart.headerPaths + = {HeaderPath{"C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sysroot/usr/include/i686-linux-android", + HeaderPathType::BuiltIn}, + HeaderPath{"C:/Users/test/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-" + "stl/llvm-libc++/include", + HeaderPathType::BuiltIn}, + HeaderPath{"C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sources/android/support/include", + HeaderPathType::BuiltIn}, + HeaderPath{"C:/Users/test/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-" + "stl/llvm-libc++abi/include", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:/Users/test/AppData/Local/Android/sdk/ndk-bundle/sysroot/usr/include", + HeaderPathType::BuiltIn}}; projectPart.toolChainTargetTriple = "i686-linux-android"; CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::UseSystemHeader::No, @@ -292,26 +305,25 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) ASSERT_THAT( compilerOptionsBuilder.options(), - ElementsAre( - "-nostdinc", - "-nostdlibinc", - "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android"), - "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include"), - "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include"), - "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include"), - "-isystem", - QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), - "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include"))); + ElementsAre("-nostdinc", + "-nostdlibinc", + "-isystem", + QDir::toNativeSeparators("C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sources/cxx-stl/llvm-libc++/include"), + "-isystem", + QDir::toNativeSeparators("C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sources/cxx-stl/llvm-libc++abi/include"), + "-isystem", + QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), + "-isystem", + QDir::toNativeSeparators("C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sysroot/usr/include/i686-linux-android"), + "-isystem", + QDir::toNativeSeparators("C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sources/android/support/include"), + "-isystem", + QDir::toNativeSeparators("C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/sysroot/usr/include"))); } TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader) diff --git a/tests/unit/unittest/completionchunkstotextconverter-test.cpp b/tests/unit/unittest/completionchunkstotextconverter-test.cpp index be911c7a76..e54161f836 100644 --- a/tests/unit/unittest/completionchunkstotextconverter-test.cpp +++ b/tests/unit/unittest/completionchunkstotextconverter-test.cpp @@ -256,7 +256,7 @@ TEST_F(CompletionChunksToTextConverter, Enumeration) ASSERT_THAT(converter.text(), QStringLiteral("Class")); } -TEST_F(CompletionChunksToTextConverter, Switch) +TEST_F(CompletionChunksToTextConverter, SwitchAsKeyword) { CodeCompletionChunks completionChunks({switchName, leftParen, @@ -273,6 +273,22 @@ TEST_F(CompletionChunksToTextConverter, Switch) ASSERT_THAT(converter.placeholderPositions().at(0), 8); } +TEST_F(CompletionChunksToTextConverter, SwitchAsName) +{ + CodeCompletionChunks completionChunks({switchName, + leftParen, + condition, + rightParen, + leftBrace, + verticalSpace, + rightBrace}); + + const QString text = ClangCodeModel::Internal::CompletionChunksToTextConverter::convertToName( + completionChunks); + + ASSERT_THAT(text, QStringLiteral("switch(){}")); +} + TEST_F(CompletionChunksToTextConverter, For) { CodeCompletionChunks completionChunks({forName, |