Merge remote-tracking branch 'origin/4.15'

Change-Id: I1d13f3543ab4bb17f0cbfe26bbea3f154f856ca6
This commit is contained in:
Eike Ziller
2021-04-20 10:42:55 +02:00
99 changed files with 1600 additions and 1265 deletions

View File

@@ -117,6 +117,7 @@ bool ignore(ClangBackEnd::HighlightingType type)
case HighlightingType::TemplateTemplateParameter:
case HighlightingType::AngleBracketOpen:
case HighlightingType::AngleBracketClose:
case HighlightingType::DoubleAngleBracketClose:
case HighlightingType::TernaryIf:
case HighlightingType::TernaryElse:
return true;
@@ -151,6 +152,8 @@ TextEditor::HighlightingResult toHighlightingResult(
result.kind = CppTools::SemanticHighlighter::AngleBracketOpen;
else if (tokenInfo.types.mixinHighlightingTypes.contains(HighlightingType::AngleBracketClose))
result.kind = CppTools::SemanticHighlighter::AngleBracketClose;
else if (tokenInfo.types.mixinHighlightingTypes.contains(HighlightingType::DoubleAngleBracketClose))
result.kind = CppTools::SemanticHighlighter::DoubleAngleBracketClose;
else if (tokenInfo.types.mixinHighlightingTypes.contains(HighlightingType::TernaryIf))
result.kind = CppTools::SemanticHighlighter::TernaryIf;
else if (tokenInfo.types.mixinHighlightingTypes.contains(HighlightingType::TernaryElse))

View File

@@ -783,6 +783,7 @@ public:
printer.showFunctionSignatures = true;
printer.showReturnTypes = true;
printer.showArgumentNames = true;
printer.showTemplateParameters = true;
Utils::ChangeSet headerChangeSet;
const CppRefactoringChanges refactoring(snapshot());
const QString filename = currentFile()->fileName();
@@ -1906,7 +1907,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
original =
"class BaseA {\n"
"public:\n"
" virtual int a() = 0;\n"
" virtual int a(const std::vector<int> &v) = 0;\n"
"};\n\n"
"class Derived : public Bas@eA {\n"
"public:\n"
@@ -1915,7 +1916,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
expected =
"class BaseA {\n"
"public:\n"
" virtual int a() = 0;\n"
" virtual int a(const std::vector<int> &v) = 0;\n"
"};\n\n"
"class Derived : public BaseA {\n"
"public:\n"
@@ -1923,7 +1924,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
"\n"
" // BaseA interface\n"
"public:\n"
" virtual int a();\n"
" virtual int a(const std::vector<int> &v);\n"
"};\n";
testFiles << Tests::QuickFixTestDocument::create("file.h", original, expected);
@@ -1932,7 +1933,7 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_implementationFile()
expected =
"#include \"file.h\"\n"
"\n\n"
"int Derived::a()\n"
"int Derived::a(const std::vector<int> &v)\n"
"{\n}";
testFiles << Tests::QuickFixTestDocument::create("file.cpp", original, expected);

View File

@@ -178,6 +178,7 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to)
for (int i = from; i < to; ++i) {
const HighlightingResult &result = m_watcher->future().resultAt(i);
if (result.kind != AngleBracketOpen && result.kind != AngleBracketClose
&& result.kind != DoubleAngleBracketClose
&& result.kind != TernaryIf && result.kind != TernaryElse) {
const QTextBlock block =
m_baseTextDocument->document()->findBlockByNumber(result.line - 1);
@@ -193,14 +194,20 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to)
parentheses.second = getClearedParentheses(parentheses.first);
}
Parenthesis paren;
if (result.kind == AngleBracketOpen)
if (result.kind == AngleBracketOpen) {
paren = {Parenthesis::Opened, '<', result.column - 1};
else if (result.kind == AngleBracketClose)
} else if (result.kind == AngleBracketClose) {
paren = {Parenthesis::Closed, '>', result.column - 1};
else if (result.kind == TernaryIf)
} else if (result.kind == DoubleAngleBracketClose) {
Parenthesis extraParen = {Parenthesis::Closed, '>', result.column - 1};
extraParen.source = parenSource();
parentheses.second.append(extraParen);
paren = {Parenthesis::Closed, '>', result.column};
} else if (result.kind == TernaryIf) {
paren = {Parenthesis::Opened, '?', result.column - 1};
else if (result.kind == TernaryElse)
} else if (result.kind == TernaryElse) {
paren = {Parenthesis::Closed, ':', result.column - 1};
}
QTC_ASSERT(paren.pos != -1, continue);
paren.source = parenSource();
parentheses.second << paren;

View File

@@ -61,6 +61,7 @@ public:
VirtualFunctionDeclarationUse,
AngleBracketOpen,
AngleBracketClose,
DoubleAngleBracketClose,
TernaryIf,
TernaryElse,
};

View File

@@ -54,6 +54,7 @@ const char HeightTag[] = "height";
const char MetadataTag[] = "metadata";
const char ChildrenTag[] = "children";
const char CustomIdTag[] = "customId";
const char QmlIdTag[] = "qmlId";
const char ExportTypeTag[] = "exportType";
const char ExportTypeComponent[] = "component";

View File

@@ -29,6 +29,7 @@
#include "componentexporter.h"
#include "qmlitemnode.h"
#include "annotation.h"
namespace {
static QString capitalize(const QString &str)
@@ -85,6 +86,9 @@ QJsonObject QmlDesigner::ItemNodeDumper::json(QmlDesigner::Component &component)
metadata.insert(ExportTypeTag, ExportTypeChild);
metadata.insert(TypeNameTag, QString::fromLatin1(m_node.type()));
if (m_node.hasCustomId())
metadata.insert(CustomIdTag, m_node.customId());
QString typeId = component.exporter().componentUuid(m_node);
if (!typeId.isEmpty())
metadata.insert(TypeIdTag, typeId);

View File

@@ -116,18 +116,17 @@ bool ItemLibraryImport::updateCategoryVisibility(const QString &searchText, bool
*changed = false;
for (const auto &category : m_categoryModel.categorySections()) {
category->setCategoryVisible(ItemLibraryModel::loadCategoryVisibleState(category->categoryName()));
bool categoryChanged = false;
bool hasVisibleItems = category->updateItemVisibility(searchText, &categoryChanged);
categoryChanged |= category->setVisible(hasVisibleItems);
if (!searchText.isEmpty() || category->isCategoryVisible()) {
bool categoryChanged = false;
bool hasVisibleItems = category->updateItemVisibility(searchText, &categoryChanged);
categoryChanged |= category->setVisible(hasVisibleItems);
*changed |= categoryChanged;
*changed |= categoryChanged;
if (hasVisibleItems)
hasVisibleCategories = true;
if (hasVisibleItems)
hasVisibleCategories = true;
}
if (searchText.isEmpty())
category->setCategoryVisible(ItemLibraryModel::loadCategoryVisibleState(category->categoryName()));
}
return hasVisibleCategories;

View File

@@ -431,8 +431,10 @@ void ItemLibraryWidget::removeImport(const QString &importUrl)
QTC_ASSERT(m_model, return);
ItemLibraryImport *importSection = m_itemLibraryModel->importByUrl(importUrl);
if (importSection)
if (importSection) {
importSection->showAllCategories();
m_model->changeImports({}, {importSection->importEntry()});
}
}
void ItemLibraryWidget::addImportForItem(const QString &importUrl)

View File

@@ -1,8 +1,11 @@
find_package(Qt5 COMPONENTS QmlDebug REQUIRED)
add_qtc_plugin(QmlPreview
DEPENDS QmlDebug QmlJS
PLUGIN_DEPENDS Core ProjectExplorer QmlJSTools QtSupport ResourceEditor QmlProjectManager
PUBLIC_DEPENDS QmlDebug
DEPENDS QmlJS
PLUGIN_DEPENDS
Core ProjectExplorer QmlJSTools QtSupport
ResourceEditor QmlProjectManager
SOURCES
qmlpreviewclient.cpp qmlpreviewclient.h
qmlpreviewconnectionmanager.cpp qmlpreviewconnectionmanager.h
@@ -34,6 +37,6 @@ find_file(have_qml_debug_translation_protocol
)
extend_qtc_plugin(QmlPreview
CONDITION have_qml_debug_translation_protocol
PUBLIC_DEPENDS Qt5::QmlDebugPrivate
DEPENDS Qt5::QmlDebugPrivate
PUBLIC_DEFINES "FOUND_QML_DEBUG_TRANSLATION_PROTOCOL"
)

View File

@@ -40,9 +40,6 @@ QmlPreviewConnectionManager::QmlPreviewConnectionManager(QObject *parent) :
QmlDebug::QmlDebugConnectionManager(parent)
{
setTarget(nullptr);
m_createDebugTranslationClientMethod = [](QmlDebug::QmlDebugConnection *connection) {
return std::make_unique<QmlPreview::QmlDebugTranslationClient>(connection);
};
}
QmlPreviewConnectionManager::~QmlPreviewConnectionManager() = default;

View File

@@ -105,6 +105,13 @@ static void defaultFpsHandler(quint16 frames[8])
Core::MessageManager::writeSilently(QString::fromLatin1("QML preview: %1 fps").arg(frames[0]));
}
static std::unique_ptr<QmlDebugTranslationClient> defaultCreateDebugTranslationClientMethod(QmlDebug::QmlDebugConnection *connection)
{
auto client = std::make_unique<QmlPreview::QmlDebugTranslationClient>(connection);
return client;
};
class QmlPreviewPluginPrivate : public QObject
{
public:
@@ -198,6 +205,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
m_fileLoader = &defaultFileLoader;
m_fileClassifer = &defaultFileClassifier;
m_fpsHandler = &defaultFpsHandler;
m_createDebugTranslationClientMethod = &defaultCreateDebugTranslationClientMethod;
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
Constants::M_BUILDPROJECT);

View File

@@ -29,6 +29,7 @@ import welcome 1.0
import StudioFonts 1.0
Item {
id: root
visible: true
width: 270
height: 175
@@ -37,6 +38,8 @@ Item {
property alias downloadIcon: downloadCloud.visible
signal clicked()
onVisibleChanged: {
animateOpacity.start()
animateScale.start()
@@ -92,6 +95,8 @@ Item {
label.color = "#686868"
}
onClicked: root.clicked()
Image {
id: downloadCloud
x: 210

View File

@@ -40,6 +40,7 @@ GridView {
imageSource: typeof(thumbnail) === "undefined" ? "images/thumbnail_test.png" : thumbnail;
labelText: displayName
downloadIcon: typeof(showDownload) === "undefined" ? false : showDownload;
onClicked: root.itemSelected(index, root.model.get(index))
SequentialAnimation {
id: animation
@@ -62,10 +63,5 @@ GridView {
easing.type: Easing.InOutExpo
}
}
MouseArea {
anchors.fill: parent
onClicked: root.itemSelected(index, root.model.get(index))
}
}
}

View File

@@ -519,8 +519,10 @@ void SubmitEditorWidget::verifyDescription()
int secondLineLength = 0;
if (subjectLength >= 0) {
const int secondLineStart = subjectLength + 1;
secondLineLength = d->m_description.indexOf(newLine, secondLineStart)
- secondLineStart;
int secondLineEnd = d->m_description.indexOf(newLine, secondLineStart);
if (secondLineEnd == -1)
secondLineEnd = descriptionLength;
secondLineLength = secondLineEnd - secondLineStart;
} else {
subjectLength = descriptionLength;
}