Merge "Merge remote-tracking branch 'origin/4.13' into master"

This commit is contained in:
The Qt Project
2020-09-14 08:49:06 +00:00
74 changed files with 874 additions and 137 deletions

View File

@@ -172,7 +172,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Utils::Id id)
QString::fromLatin1("-DANDROID_SDK:PATH=%1").arg(sdkLocation.toString()));
}
initialArgs.append(QString::fromLatin1("-DANDROID_STL:STRING=cxx_shared"));
initialArgs.append(QString::fromLatin1("-DANDROID_STL:STRING=c++_shared"));
initialArgs.append(
QString::fromLatin1("-DCMAKE_FIND_ROOT_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}"));

View File

@@ -356,7 +356,7 @@ Link attemptDeclDef(const QTextCursor &cursor, Snapshot snapshot,
funcDecl = decl->postfix_declarator_list->value->asFunctionDeclarator();
if (funcDecl)
target = symbolFinder->findMatchingDefinition(funcDecl->symbol, snapshot);
else
else if (simpleDecl->symbols)
target = symbolFinder->findMatchingVarDefinition(simpleDecl->symbols->value, snapshot);
}

View File

@@ -41,6 +41,7 @@
#include <debugger/debuggertooltipmanager.h>
#include <debugger/disassembleragent.h>
#include <debugger/disassemblerlines.h>
#include <debugger/enginemanager.h>
#include <debugger/memoryagent.h>
#include <debugger/moduleshandler.h>
#include <debugger/registerhandler.h>
@@ -732,7 +733,8 @@ bool CdbEngine::hasCapability(unsigned cap) const
| CreateFullBacktraceCapability
| OperateByInstructionCapability
| RunToLineCapability
| MemoryAddressCapability);
| MemoryAddressCapability
| AdditionalQmlStackCapability);
}
void CdbEngine::executeStepIn(bool byInstruction)
@@ -2630,6 +2632,8 @@ static StackFrames parseFrames(const GdbMi &gdbmi, bool *incomplete = nullptr)
frame.language = QmlLanguage;
}
frame.function = frameMi["function"].data();
if (frame.function.isEmpty())
frame.function = frameMi["func"].data(); // GDB's *stopped messages
frame.module = frameMi["from"].data();
frame.context = frameMi["context"].data();
frame.address = frameMi["address"].data().toULongLong(nullptr, 16);
@@ -2687,6 +2691,14 @@ unsigned CdbEngine::parseStackTrace(const GdbMi &data, bool sourceStepInto)
void CdbEngine::loadAdditionalQmlStack()
{
// Creating a qml stack while the QmlEngine is stopped results in a frozen inferior.
const auto engineList = EngineManager::engines();
for (DebuggerEngine *engine : engineList) {
if (engine->objectName() == "QmlEngine" && engine->state() == Debugger::InferiorStopOk) {
showMessage("Can't create a QML stack trace while the QML Debugger is in the Stopped state", StatusBar);
return;
}
}
runCommand({"qmlstack", ExtensionCommand, CB(handleAdditionalQmlStack)});
}

View File

@@ -7,5 +7,14 @@
\"Copyright\" : \"(C) IncrediBuild\",
\"Category\" : \"Build Systems\",
\"Url\" : \"http://www.IncrediBuild.com\",
\"License\" : [ \"Commercial Usage\",
\"\",
\"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
\"\",
\"GNU General Public License Usage\",
\"\",
\"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
],
\"Description\" : \"Support for Incredibuild.\",
$$dependencyList
}

View File

@@ -1119,16 +1119,13 @@ void Client::resetAssistProviders(TextEditor::TextDocument *document)
{
const AssistProviders providers = m_resetAssistProvider.take(document);
if (document->completionAssistProvider() == m_clientProviders.completionAssistProvider &&
providers.completionAssistProvider)
if (document->completionAssistProvider() == m_clientProviders.completionAssistProvider)
document->setCompletionAssistProvider(providers.completionAssistProvider);
if (document->functionHintAssistProvider() == m_clientProviders.functionHintProvider &&
providers.functionHintProvider)
if (document->functionHintAssistProvider() == m_clientProviders.functionHintProvider)
document->setFunctionHintAssistProvider(providers.functionHintProvider);
if (document->quickFixAssistProvider() == m_clientProviders.quickFixAssistProvider &&
providers.quickFixAssistProvider)
if (document->quickFixAssistProvider() == m_clientProviders.quickFixAssistProvider)
document->setQuickFixAssistProvider(providers.quickFixAssistProvider);
}
@@ -1139,6 +1136,15 @@ void Client::sendPostponedDocumentUpdates()
return;
TextEditor::TextEditorWidget *currentWidget
= TextEditor::TextEditorWidget::currentTextEditorWidget();
struct DocumentUpdate
{
TextEditor::TextDocument *document;
DidChangeTextDocumentNotification notification;
};
QList<DocumentUpdate> updates;
const QList<TextEditor::TextDocument *> documents = m_documentsToUpdate.keys();
for (auto document : documents) {
const auto uri = DocumentUri::fromFilePath(document->filePath());
@@ -1148,10 +1154,15 @@ void Client::sendPostponedDocumentUpdates()
DidChangeTextDocumentParams params;
params.setTextDocument(docId);
params.setContentChanges(m_documentsToUpdate.take(document));
sendContent(DidChangeTextDocumentNotification(params));
emit documentUpdated(document);
if (currentWidget && currentWidget->textDocument() == document)
updates.append({document, DidChangeTextDocumentNotification(params)});
}
for (const DocumentUpdate &update : qAsConst(updates)) {
sendContent(update.notification);
emit documentUpdated(update.document);
if (currentWidget && currentWidget->textDocument() == update.document)
cursorPositionChanged(currentWidget);
}
}

View File

@@ -316,7 +316,7 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn
m_pos = interface->position();
if (interface->reason() == IdleEditor) {
// Trigger an automatic completion request only when we are on a word with at least n "identifier" characters
const QRegularExpression regexp("[_a-zA-Z0-9]+");
const QRegularExpression regexp("^[_a-zA-Z0-9]+$");
auto hasMatch = [&regexp](const QString &txt) { return regexp.match(txt).hasMatch(); };
int delta = 0;
while (m_pos - delta > 0 && hasMatch(interface->textAt(m_pos - delta - 1, delta + 1)))

View File

@@ -8,9 +8,9 @@
\"\",
\"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
\"\",
\"GNU Lesser General Public License Usage\",
\"GNU General Public License Usage\",
\"\",
\"Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\"
\"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
],
\"Category\" : \"Other Languages\",
\"Description\" : \"Plugin for supporting the Nim programming language.\",

View File

@@ -1731,8 +1731,11 @@ void ClangToolChainConfigWidget::updateParentToolChainComboBox()
return;
for (const ToolChain *mingwTC : mingwToolChains()) {
if (parentId != mingwTC->id())
m_parentToolchainCombo->addItem(mingwTC->displayName(), mingwTC->id());
if (mingwTC->id() == parentId)
continue;
if (mingwTC->language() != tc->language())
continue;
m_parentToolchainCombo->addItem(mingwTC->displayName(), mingwTC->id());
}
}

View File

@@ -836,10 +836,12 @@ void RunControl::setupFormatter(OutputFormatter *formatter) const
}
}
formatter->setLineParsers(parsers);
Utils::FileInProjectFinder fileFinder;
fileFinder.setProjectDirectory(project()->projectDirectory());
fileFinder.setProjectFiles(project()->files(Project::AllFiles));
formatter->setFileFinder(fileFinder);
if (project()) {
Utils::FileInProjectFinder fileFinder;
fileFinder.setProjectDirectory(project()->projectDirectory());
fileFinder.setProjectFiles(project()->files(Project::AllFiles));
formatter->setFileFinder(fileFinder);
}
}
Utils::Id RunControl::runMode() const

View File

@@ -155,6 +155,11 @@ void ToolChain::setDisplayName(const QString &name)
toolChainUpdated();
}
bool ToolChain::isAutoDetected() const
{
return detection() == AutoDetection || detection() == AutoDetectionFromSdk;
}
ToolChain::Detection ToolChain::detection() const
{
return d->m_detection;

View File

@@ -99,7 +99,7 @@ public:
QString displayName() const;
void setDisplayName(const QString &name);
inline bool isAutoDetected() const { return detection() != ManualDetection; }
bool isAutoDetected() const;
Detection detection() const;
QByteArray id() const;

View File

@@ -50,11 +50,12 @@
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <memory>
#include <QDebug>
#include <QPair>
#include <QPicture>
#include <QString>
#include <QTimer>
#include <memory>
namespace QmlDesigner {
@@ -770,6 +771,11 @@ void FormEditorView::exportAsImage()
m_formEditorWidget->exportAsImage(m_scene->rootFormEditorItem()->boundingRect());
}
QPicture FormEditorView::renderToPicture() const
{
return m_formEditorWidget->renderToPicture();
}
QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
{
QmlObjectNode qmlObjectNode = firstQmlObjectNode;

View File

@@ -128,6 +128,7 @@ public:
void setGotoErrorCallback(std::function<void(int, int)> gotoErrorCallback);
void exportAsImage();
QPicture renderToPicture() const;
protected:
void reset();

View File

@@ -53,6 +53,7 @@
#include <QActionGroup>
#include <QFileDialog>
#include <QPainter>
#include <QPicture>
#include <QVBoxLayout>
#include <QWheelEvent>
@@ -487,6 +488,19 @@ void FormEditorWidget::exportAsImage(const QRectF &boundingRect)
}
}
QPicture FormEditorWidget::renderToPicture() const
{
QPicture picture;
QPainter painter{&picture};
const QTransform viewportTransform = m_graphicsView->viewportTransform();
const QRectF boundingRect = rootItemRect();
m_graphicsView->render(&painter, boundingRect, viewportTransform.mapRect(boundingRect.toRect()));
return picture;
}
FormEditorGraphicsView *FormEditorWidget::graphicsView() const
{
return m_graphicsView;
@@ -504,7 +518,4 @@ DocumentWarningWidget *FormEditorWidget::errorWidget()
return m_documentErrorWidget;
}
}
} // namespace QmlDesigner

View File

@@ -83,6 +83,7 @@ public:
void showWarningMessageBox(const QList<DocumentMessage> &warnings);
void exportAsImage(const QRectF &boundingRect);
QPicture renderToPicture() const;
FormEditorGraphicsView *graphicsView() const;

View File

@@ -348,18 +348,19 @@ void PresetList::contextMenuEvent(QContextMenuEvent *event)
if (m_scope == QSettings::SystemScope)
return;
QMenu menu;
auto *menu = new QMenu(this);
QAction *addAction = menu.addAction(tr("Add Preset"));
QAction *addAction = menu->addAction(tr("Add Preset"));
connect(addAction, &QAction::triggered, [&]() { createItem(); });
if (selectionModel()->hasSelection()) {
QAction *removeAction = menu.addAction(tr("Delete Selected Preset"));
QAction *removeAction = menu->addAction(tr("Delete Selected Preset"));
connect(removeAction, &QAction::triggered, [&]() { removeSelectedItem(); });
}
menu.exec(event->globalPos());
menu->exec(event->globalPos());
menu->deleteLater();
}
void PresetList::dataChanged(const QModelIndex &topLeft,

View File

@@ -253,6 +253,7 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e)
});
menu->exec(e->globalPos());
menu->deleteLater();
e->accept();
}

View File

@@ -99,6 +99,7 @@ public:
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) override;
void capturedData(const CapturedDataCommand &capturedData) override;
void currentStateChanged(const ModelNode &node) override;
void sceneCreated(const SceneCreatedCommand &command) override;
QList<NodeInstance> instances() const;
NodeInstance instanceForModelNode(const ModelNode &node) const ;

View File

@@ -64,6 +64,7 @@
#include "removepropertiescommand.h"
#include "removesharedmemorycommand.h"
#include "reparentinstancescommand.h"
#include "scenecreatedcommand.h"
#include "statepreviewimagechangedcommand.h"
#include "tokencommand.h"
#include "update3dviewstatecommand.h"
@@ -585,10 +586,10 @@ void NodeInstanceView::currentStateChanged(const ModelNode &node)
nodeInstanceView()->activateBaseState();
}
void NodeInstanceView::sceneCreated(const SceneCreatedCommand &) {}
//\}
void NodeInstanceView::removeAllInstanceNodeRelationships()
{
m_nodeInstanceHash.clear();

View File

@@ -516,8 +516,13 @@ QString AbstractView::generateNewId(const QString &prefixName, const QString &fa
QString newBaseId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName));
newBaseId.remove(QRegularExpression(QStringLiteral("[^a-zA-Z0-9_]")));
if (newBaseId.isEmpty())
if (!newBaseId.isEmpty()) {
QChar firstChar = newBaseId.at(0);
if (firstChar.isDigit())
newBaseId.prepend('_');
} else {
newBaseId = fallbackPrefix;
}
QString newId = newBaseId;

View File

@@ -135,6 +135,7 @@ Project {
"commands/changevaluescommand.cpp",
"commands/changevaluescommand.h",
"commands/captureddatacommand.h",
"commands/scenecreatedcommand.h",
"commands/childrenchangedcommand.cpp",
"commands/childrenchangedcommand.h",
"commands/clearscenecommand.cpp",

View File

@@ -50,6 +50,30 @@
<description><![CDATA[Creating a Qt Quick application.]]></description>
<tags>qt creator,qt quick,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Design Studio QuickTip: UI Navigation" isVideo="true" videoUrl="https://www.youtube.com/watch?v=RfEYO-5Mw6s" videoLength="1:00">
<description><![CDATA[Navigating in Qt Quick Designer and using the different views.]]></description>
<tags>qt creator,qt quick,views,quick tip,video,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Design Studio QuickTip: Animated Image" isVideo="true" videoUrl="https://www.youtube.com/watch?v=DVWd_xMMgvg" videoLength="1:00">
<description><![CDATA[Using the basic AnimatedImage QML type to add GIF images to UIs.]]></description>
<tags>qt creator,qt quick,animated image,gif,quick tip,qml,video,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Design Studio QuickTip: Bindings" isVideo="true" videoUrl="https://www.youtube.com/watch?v=UfvA04CIXv0" videoLength="1:00">
<description><![CDATA[Using bindings to dynamically change the behavior of an object.]]></description>
<tags>qt creator,qt quick,bindings,quick tip,qml,video,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Design Studio QuickTip: Slider" isVideo="true" videoUrl="https://www.youtube.com/watch?v=Ed8WS03C-Vk" videoLength="1:00">
<description><![CDATA[Using the Slider Qt Quick control to create a slider.]]></description>
<tags>qt creator,qt quick,slider,quick tip,controls,video,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Design Studio QuickTip: States" isVideo="true" videoUrl="https://www.youtube.com/watch?v=FzmLuRHQXaw" videoLength="1:00">
<description><![CDATA[Using states in a UI.]]></description>
<tags>qt creator,qt quick,slider,quick tip,controls,video,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Design Studio QuickTip: Text Element" isVideo="true" videoUrl="https://www.youtube.com/watch?v=yOUdg1o2KJM" videoLength="1:00">
<description><![CDATA[Using the basic Text QML type to create a text label with a custom font.]]></description>
<tags>qt creator,qt quick,quick tip,qml,test,video,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt SCXML and State Machine Tooling in Qt Creator" isVideo="true" videoUrl="https://youtu.be/9xqhq9nDiOg" videoLength="4:53">
<description><![CDATA[Creating state machines.]]></description>
<tags>qt creator,SCXML,video</tags>
@@ -79,9 +103,9 @@
<tags>qt creator,qt quick,controls,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Introduction to Qt Creator" isVideo="true" videoUrl="https://www.youtube.com/watch?v=nGFmjOiT22Y" videoLength="50:36">
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Introduction to Qt Creator IDE" isVideo="true" videoUrl="https://www.youtube.com/watch?v=nGFmjOiT22Y" videoLength="1:06:32">
<description><![CDATA[Getting started with using Qt Creator for cross-platform development.]]></description>
<tags>qt creator,talk,2015</tags>
<tags>qt creator,talk,2020</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Custom Qt Creator Wizards" isVideo="true" videoUrl="https://www.youtube.com/watch?v=Ko3DuCgFamo" videoLength="27:21">
<description><![CDATA[Adding custom file and project creation wizards to Qt Creator.]]></description>
@@ -123,11 +147,6 @@
<description><![CDATA[Developing Qt Applications for Bare Metal devices.]]></description>
<tags>qt creator,baremetal,talk,2013</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Integrating Universal Windows Platform to Qt" isVideo="true" videoUrl="https://youtu.be/tpNdw2Cs4KY" videoLength="47:38">
<description><![CDATA[Qt support for Universal Windows Platform on desktop, mobile, and embedded devices.]]></description>
<tags>uwp,talk,2016</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Developing User Interfaces with Qt Quick Controls 2" isVideo="true" videoUrl="https://youtu.be/ozpSl7WbVt4" videoLength="23:13">
<description><![CDATA[Using Qt Quick Controls 2 to create UIs.]]></description>
<tags>ui,qt quick designer,controls,ui,talk,2016</tags>
@@ -148,10 +167,6 @@
<description><![CDATA[Best practices for an efficient app lifecycle.]]></description>
<tags>qt,qt quick,screen resolution,ui,talk,2016</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: App Development with Qt - Technical Tips and Examples for Development &amp; Testing" isVideo="true" videoUrl="https://www.youtube.com/watch?v=OqqarK73I9E" videoLength="53:57">
<description><![CDATA[Technical tips and examples for developing and testing mobile apps.]]></description>
<tags>android,ios,talk,2017</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Qt Designer tutorial: Integrate custom widgets" isVideo="true" videoUrl="https://youtu.be/B0X5FOev9Lw" videoLength="27:07">
<description><![CDATA[Integrating custom widgets into Qt Designer.]]></description>
<tags>qt designer,widgets,ui,talk,2019</tags>
@@ -176,10 +191,6 @@
<description><![CDATA[Using Qt Creator kits and Yocto when developing for embedded devices.]]></description>
<tags>qt creator,kits,yocto,embedded,talk,2019</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: How to build QML apps for webOS and the Qt Creator webOS Plugin" isVideo="true" videoUrl="https://youtu.be/Yms_MvWQVR0" videoLength="24:58">
<description><![CDATA[Running Qt Quick apps on webOS.]]></description>
<tags>qt quick,ui,webos,talk,2019</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: How to build your first 'Qt for MCUs' application" isVideo="true" videoUrl="https://youtu.be/BkgjJfxYN20" videoLength="21:54">
<description><![CDATA[Building your first application for the NXP IMXRT1050 device.]]></description>
<tags>qtformcus,mcus,qt,video,NXP IMXRT1050-EVKB,2020</tags>

View File

@@ -622,8 +622,11 @@ bool TextDocument::save(QString *errorString, const QString &saveFileName, bool
cursor.beginEditBlock();
cursor.movePosition(QTextCursor::Start);
if (d->m_storageSettings.m_cleanWhitespace)
cleanWhitespace(cursor, d->m_storageSettings);
if (d->m_storageSettings.m_cleanWhitespace) {
cleanWhitespace(cursor,
d->m_storageSettings.m_inEntireDocument,
d->m_storageSettings.m_cleanIndentation);
}
if (d->m_storageSettings.m_addFinalNewLine)
ensureFinalNewLine(cursor);
cursor.endEditBlock();
@@ -885,7 +888,7 @@ void TextDocument::cleanWhitespace(const QTextCursor &cursor)
copyCursor.setVisualNavigation(false);
copyCursor.beginEditBlock();
cleanWhitespace(copyCursor, d->m_storageSettings);
cleanWhitespace(copyCursor, true, true);
if (!hasSelection)
ensureFinalNewLine(copyCursor);
@@ -893,11 +896,9 @@ void TextDocument::cleanWhitespace(const QTextCursor &cursor)
copyCursor.endEditBlock();
}
void TextDocument::cleanWhitespace(QTextCursor &cursor, const StorageSettings &storageSettings)
void TextDocument::cleanWhitespace(QTextCursor &cursor, bool inEntireDocument,
bool cleanIndentation)
{
if (!d->m_storageSettings.m_cleanWhitespace)
return;
const QString fileName(filePath().fileName());
auto documentLayout = qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
@@ -910,8 +911,9 @@ void TextDocument::cleanWhitespace(QTextCursor &cursor, const StorageSettings &s
QVector<QTextBlock> blocks;
while (block.isValid() && block != end) {
if (storageSettings.m_inEntireDocument || block.revision() != documentLayout->lastSaveRevision)
if (inEntireDocument || block.revision() != documentLayout->lastSaveRevision) {
blocks.append(block);
}
block = block.next();
}
if (blocks.isEmpty())
@@ -924,11 +926,11 @@ void TextDocument::cleanWhitespace(QTextCursor &cursor, const StorageSettings &s
foreach (block, blocks) {
QString blockText = block.text();
if (storageSettings.removeTrailingWhitespace(fileName))
if (d->m_storageSettings.removeTrailingWhitespace(fileName))
currentTabSettings.removeTrailingWhitespace(cursor, block);
const int indent = indentations[block.blockNumber()];
if (storageSettings.m_cleanIndentation && !currentTabSettings.isIndentationClean(block, indent)) {
if (cleanIndentation && !currentTabSettings.isIndentationClean(block, indent)) {
cursor.setPosition(block.position());
int firstNonSpace = currentTabSettings.firstNonSpace(blockText);
if (firstNonSpace == blockText.length()) {

View File

@@ -170,7 +170,7 @@ protected:
private:
OpenResult openImpl(QString *errorString, const QString &fileName, const QString &realFileName,
bool reload);
void cleanWhitespace(QTextCursor &cursor, const StorageSettings &storageSettings);
void cleanWhitespace(QTextCursor &cursor, bool inEntireDocument, bool cleanIndentation);
void ensureFinalNewLine(QTextCursor &cursor);
void modificationChanged(bool modified);
void updateLayout() const;

View File

@@ -468,7 +468,6 @@ struct PaintEventBlockData
{
QRectF boundingRect;
QVector<QTextLayout::FormatRange> selections;
QVector<QTextLayout::FormatRange> prioritySelections;
QRectF blockSelectionCursorRect;
QTextLayout *layout = nullptr;
int position = 0;
@@ -4704,6 +4703,7 @@ void TextEditorWidgetPrivate::setupBlockLayout(const PaintEventData &data,
void TextEditorWidgetPrivate::setupSelections(const PaintEventData &data,
PaintEventBlockData &blockData) const
{
QVector<QTextLayout::FormatRange> prioritySelections;
for (int i = 0; i < data.context.selections.size(); ++i) {
const QAbstractTextDocumentLayout::Selection &range = data.context.selections.at(i);
const int selStart = range.cursor.selectionStart() - blockData.position;
@@ -4720,18 +4720,25 @@ void TextEditorWidgetPrivate::setupSelections(const PaintEventData &data,
o.start = ts.positionAtColumn(text, m_blockSelection.firstVisualColumn());
o.length = ts.positionAtColumn(text, m_blockSelection.lastVisualColumn()) - o.start;
}
if (data.textCursor.hasSelection() && data.textCursor == range.cursor) {
const QTextCharFormat selectionFormat = data.fontSettings.toTextCharFormat(C_SELECTION);
if (selectionFormat.background().style() != Qt::NoBrush)
o.format.setBackground(selectionFormat.background());
if (selectionFormat.foreground().style() != Qt::NoBrush)
o.format.setForeground(selectionFormat.foreground());
}
if ((data.textCursor.hasSelection() && i == data.context.selections.size() - 1)
|| (o.format.foreground().style() == Qt::NoBrush
&& o.format.underlineStyle() != QTextCharFormat::NoUnderline
&& o.format.background() == Qt::NoBrush)) {
if (q->selectionVisible(data.block.blockNumber()))
blockData.prioritySelections.append(o);
prioritySelections.append(o);
} else {
blockData.selections.append(o);
}
}
}
blockData.selections += blockData.prioritySelections;
blockData.selections.append(prioritySelections);
}
void TextEditorWidgetPrivate::setupCursorPosition(PaintEventData &data,