Merge remote-tracking branch 'origin/4.14'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I5b8d93f2f08b62626c3f3447728c64d198b601ff
This commit is contained in:
Eike Ziller
2021-01-04 09:09:21 +01:00
30 changed files with 187 additions and 87 deletions

View File

@@ -9,8 +9,10 @@ option(CLANGTOOLING_LINK_CLANG_DYLIB "Force linking of Clang tooling against cla
if (TARGET clangTooling AND NOT CLANGTOOLING_LINK_CLANG_DYLIB)
set(CLANG_TOOLING_LIBS libclang clangTooling clangQuery clangIndex)
set(CLANG_FORMAT_LIB clangFormat)
elseif (TARGET clang-cpp)
set(CLANG_TOOLING_LIBS libclang clang-cpp)
set(CLANG_FORMAT_LIB clang-cpp)
endif()

View File

@@ -36,6 +36,7 @@ set(_THIS_MODULE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
option(BUILD_PLUGINS_BY_DEFAULT "Build plugins by default. This can be used to build all plugins by default, or none." ON)
option(BUILD_EXECUTABLES_BY_DEFAULT "Build executables by default. This can be used to build all executables by default, or none." ON)
option(BUILD_LIBRARIES_BY_DEFAULT "Build libraries by default. This can be used to build all libraries by default, or none." ON)
option(QTC_SEPARATE_DEBUG_INFO "Extract debug information from binary files." OFF)
# If we provide a list of plugins, executables, libraries, then the BUILD_<type>_BY_DEFAULT will be set to OFF
# and for every element we set BUILD_<type>_<elment> to ON
@@ -302,7 +303,7 @@ function(add_qtc_plugin target_name)
cmake_parse_arguments(_arg
"SKIP_DEBUG_CMAKE_FILE_CHECK;SKIP_INSTALL;INTERNAL_ONLY;SKIP_TRANSLATION;EXPORT"
"VERSION;COMPAT_VERSION;PLUGIN_JSON_IN;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT"
"CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PROPERTIES"
"CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PLUGIN_TEST_DEPENDS;PROPERTIES"
${ARGN}
)
@@ -388,6 +389,15 @@ function(add_qtc_plugin target_name)
" { \"Name\" : \"${i}\", \"Version\" : \"${_v}\", \"Type\" : \"optional\" }"
)
endforeach(i)
foreach(i IN LISTS _arg_PLUGIN_TEST_DEPENDS)
if (i MATCHES "^QtCreator::")
string(REPLACE "QtCreator::" "" i ${i})
endif()
set(_v ${IDE_VERSION})
string(APPEND _arg_DEPENDENCY_STRING
" { \"Name\" : \"${i}\", \"Version\" : \"${_v}\", \"Type\" : \"test\" }"
)
endforeach(i)
string(REPLACE "} {" "},\n {"
_arg_DEPENDENCY_STRING "${_arg_DEPENDENCY_STRING}"

View File

@@ -3,9 +3,9 @@ set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()
# Enable separate debug information for the given target
# when doing RelWithDebInfo build
# when QTC_SEPARATE_DEBUG_INFO is set
function(qtc_enable_separate_debug_info target installDestination)
if (NOT CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
if (NOT QTC_SEPARATE_DEBUG_INFO)
return()
endif()
if (NOT UNIX AND NOT MINGW)

View File

@@ -119,9 +119,11 @@ def build_qtcreator(args, paths):
with_docs_str = 'OFF' if args.no_docs else 'ON'
build_date_option = 'OFF' if args.no_build_date else 'ON'
test_option = 'ON' if args.with_tests else 'OFF'
separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF'
cmake_args = ['cmake',
'-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
'-DCMAKE_BUILD_TYPE=' + args.build_type,
'-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option,
'-DSHOW_BUILD_DATE=' + build_date_option,
'-DWITH_DOCS=' + with_docs_str,
'-DBUILD_DEVELOPER_DOCS=' + with_docs_str,

View File

@@ -70,9 +70,11 @@ def build(args, paths):
os.makedirs(paths.result)
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt]
prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths]
separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF'
cmake_args = ['cmake',
'-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
'-DCMAKE_BUILD_TYPE=' + args.build_type,
'-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option,
'-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
'-G', 'Ninja']

View File

@@ -1464,17 +1464,19 @@ class Dumper(DumperBase):
elif eventType == lldb.SBProcess.eBroadcastBitInterrupt: # 2
pass
elif eventType == lldb.SBProcess.eBroadcastBitSTDOUT:
# FIXME: Size?
msg = self.process.GetSTDOUT(1024)
if msg is not None:
self.report('output={channel="stdout",data="%s"}' % self.hexencode(msg))
self.handleInferiorOutput(self.process.GetSTDOUT, "stdout")
elif eventType == lldb.SBProcess.eBroadcastBitSTDERR:
msg = self.process.GetSTDERR(1024)
if msg is not None:
self.report('output={channel="stderr",data="%s"}' % self.hexencode(msg))
self.handleInferiorOutput(self.process.GetSTDERR, "stderr")
elif eventType == lldb.SBProcess.eBroadcastBitProfileData:
pass
def handleInferiorOutput(self, proc, channel):
while True:
msg = proc(1024)
if msg == None or len(msg) == 0:
break
self.report('output={channel="%s",data="%s"}' % (channel, self.hexencode(msg)))
def describeBreakpoint(self, bp):
isWatch = isinstance(bp, lldb.SBWatchpoint)
if isWatch:

View File

@@ -44,6 +44,7 @@ add_qtc_library(KSyntaxHighlighting SHARED
)
qtc_add_public_header(autogenerated/src/lib/State)
if(TARGET KSyntaxHighlighting)
install(
DIRECTORY data/syntax
DESTINATION "${IDE_DATA_PATH}/generic-highlighter/"
@@ -54,3 +55,4 @@ qtc_copy_to_builddir(copy_generic_highligher_to_builddir
DIRECTORIES data/syntax
DESTINATION "${IDE_DATA_PATH}/generic-highlighter/syntax"
)
endif()

View File

@@ -4019,14 +4019,16 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead AssignmentExpress
/.
case $rule_number: {
AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression);
ret->returnToken = sym(4).Node->firstSourceLocation();
ret->semicolonToken = sym(4).Node->lastSourceLocation();
const auto zeroLength = [](SourceLocation l){ l.length = 0; return l; };
ret->returnToken = zeroLength(sym(4).Node->firstSourceLocation());
ret->semicolonToken = zeroLength(sym(4).Node->lastSourceLocation());
AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish();
AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements);
AST::FunctionExpression *f = new (pool)
AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = sym(4).Node->firstSourceLocation();
f->rbraceToken = sym(4).Node->lastSourceLocation();
f->lbraceToken = zeroLength(sym(4).Node->firstSourceLocation());
f->rbraceToken = zeroLength(sym(4).Node->lastSourceLocation());
sym(1).Node = f;
} break;
./
@@ -4039,7 +4041,7 @@ ArrowFunction_In: ArrowParameters T_ARROW ConciseBodyLookahead T_FORCE_BLOCK Fun
AST::FunctionExpression *f = new (pool) AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = loc(6);
f->lbraceToken = loc(5);
f->rbraceToken = loc(7);
sym(1).Node = f;
} break;

View File

@@ -3001,15 +3001,16 @@ case 241: {
case 528: {
AST::ReturnStatement *ret = new (pool) AST::ReturnStatement(sym(4).Expression);
ret->returnToken = sym(4).Node->firstSourceLocation();
ret->semicolonToken = sym(4).Node->lastSourceLocation();
const auto zeroLength = [](SourceLocation l){ l.length = 0; return l; };
ret->returnToken = zeroLength(sym(4).Node->firstSourceLocation());
ret->semicolonToken = zeroLength(sym(4).Node->lastSourceLocation());
AST::StatementList *statements = (new (pool) AST::StatementList(ret))->finish();
AST::FunctionExpression *f = new (pool)
AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, statements);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = sym(4).Node->firstSourceLocation();
f->rbraceToken = sym(4).Node->lastSourceLocation();
f->lbraceToken = zeroLength(sym(4).Node->firstSourceLocation());
f->rbraceToken = zeroLength(sym(4).Node->lastSourceLocation());
sym(1).Node = f;
} break;
@@ -3022,7 +3023,7 @@ case 241: {
AST::FunctionExpression(QStringView(), sym(1).FormalParameterList, sym(6).StatementList);
f->isArrowFunction = true;
f->functionToken = sym(1).Node ? sym(1).Node->firstSourceLocation() : loc(1);
f->lbraceToken = loc(6);
f->lbraceToken = loc(5);
f->rbraceToken = loc(7);
sym(1).Node = f;
} break;

View File

@@ -802,6 +802,13 @@ protected:
bool visit(StringLiteralPropertyName *ast) override { out(ast->id.toString()); return true; }
bool visit(NumericLiteralPropertyName *ast) override { out(QString::number(ast->id)); return true; }
bool visit(TemplateLiteral *ast) override
{
out(ast->literalToken);
accept(ast->expression);
return true;
}
bool visit(ArrayMemberExpression *ast) override
{
accept(ast->base);
@@ -1097,6 +1104,7 @@ protected:
{
out(ast->returnToken);
if (ast->expression) {
if (ast->returnToken.isValid())
out(" ");
accept(ast->expression);
}
@@ -1218,17 +1226,32 @@ protected:
bool visit(FunctionExpression *ast) override
{
if (!ast->isArrowFunction) {
out("function ", ast->functionToken);
if (!ast->name.isNull())
out(ast->identifierToken);
}
out(ast->lparenToken);
if (ast->isArrowFunction && ast->formals && ast->formals->next)
out("(");
accept(ast->formals);
if (ast->isArrowFunction && ast->formals && ast->formals->next)
out(")");
out(ast->rparenToken);
if (ast->isArrowFunction && !ast->formals)
out("()");
out(" ");
if (ast->isArrowFunction)
out("=> ");
out(ast->lbraceToken);
if (ast->body) {
if (ast->body->next || ast->lbraceToken.isValid()) {
lnAcceptIndented(ast->body);
newLine();
} else {
// print a single statement in one line. E.g. x => x * 2
accept(ast->body);
}
}
out(ast->rbraceToken);
return false;

View File

@@ -1,9 +1,6 @@
if (WITH_TESTS)
set(TEST_COMPONENT QmakeProjectManager QtSupport)
endif()
add_qtc_plugin(AutoTest
PLUGIN_DEPENDS Core CppTools Debugger ProjectExplorer QmlJSTools TextEditor ${TEST_COMPONENT}
PLUGIN_DEPENDS Core CppTools Debugger ProjectExplorer QmlJSTools TextEditor
PLUGIN_TEST_DEPENDS QmakeProjectManager QtSupport QbsProjectManager
SOURCES
autotest.qrc
autotest_global.h

View File

@@ -1,11 +1,8 @@
if (WITH_TESTS)
set(TST_COMPONENT CppEditor QmakeProjectManager)
endif()
add_qtc_plugin(ClangCodeModel
CONDITION TARGET libclang
DEPENDS ClangSupport CPlusPlus
PLUGIN_DEPENDS Core CppTools TextEditor ${TST_COMPONENT}
PLUGIN_DEPENDS Core CppTools TextEditor
PLUGIN_TEST_DEPENDS CppEditor QmakeProjectManager
SOURCES
clangactivationsequencecontextprocessor.cpp clangactivationsequencecontextprocessor.h
clangactivationsequenceprocessor.cpp clangactivationsequenceprocessor.h

View File

@@ -1,6 +1,6 @@
add_qtc_plugin(ClangFormat
CONDITION TARGET libclang AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 10.0.0 AND QTC_CLANG_BUILDMODE_MATCH
DEPENDS Utils Qt5::Widgets clangFormat
DEPENDS Utils Qt5::Widgets ${CLANG_FORMAT_LIB}
INCLUDES "${CLANG_INCLUDE_DIRS}"
PLUGIN_DEPENDS Core TextEditor CppEditor CppTools ProjectExplorer
SOURCES

View File

@@ -1,14 +1,11 @@
if (WITH_TESTS)
set(TST_COMPONENT QmakeProjectManager)
endif()
find_package(yaml-cpp QUIET MODULE)
add_qtc_plugin(ClangTools
CONDITION TARGET yaml-cpp
DEPENDS ClangSupport yaml-cpp
PLUGIN_DEPENDS Core Debugger CppTools CppEditor ${TST_COMPONENT}
PLUGIN_DEPENDS Core Debugger CppTools CppEditor
PLUGIN_RECOMMENDS CppEditor
PLUGIN_TEST_DEPENDS QmakeProjectManager QbsProjectManager
INCLUDES ${CLANG_INCLUDE_DIRS}
SOURCES
clangfileinfo.h

View File

@@ -32,7 +32,7 @@
namespace Core {
namespace Internal {
enum class EngineAction { Reset, Abort };
enum class EngineAction { Reset = 1, Abort };
JavaScriptFilter::JavaScriptFilter()
{
@@ -98,11 +98,13 @@ void JavaScriptFilter::accept(Core::LocatorFilterEntry selection, QString *newTe
if (selection.internalData.isNull())
return;
if (selection.internalData.canConvert<EngineAction>()
&& selection.internalData.value<EngineAction>() == EngineAction::Reset) {
const EngineAction action = selection.internalData.value<EngineAction>();
if (action == EngineAction::Reset) {
m_engine.reset();
return;
}
if (action == EngineAction::Abort)
return;
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setText(selection.internalData.toString());

View File

@@ -1,6 +1,7 @@
add_qtc_plugin(CppEditor
DEFINES CPPEDITOR_LIBRARY
PLUGIN_DEPENDS Core CppTools ProjectExplorer TextEditor
PLUGIN_TEST_DEPENDS QmakeProjectManager
SOURCES
cppautocompleter.cpp cppautocompleter.h
cppcodemodelinspectordialog.cpp cppcodemodelinspectordialog.h cppcodemodelinspectordialog.ui

View File

@@ -2,6 +2,7 @@ add_qtc_plugin(Debugger
DEPENDS LanguageUtils QmlDebug QmlJS QtcSsh registryaccess
PLUGIN_DEPENDS Core CppTools ProjectExplorer QtSupport TextEditor
PLUGIN_RECOMMENDS QmakeProjectManager
PLUGIN_TEST_DEPENDS QmakeProjectManager
SOURCES
analyzer/analyzerbase.qrc
analyzer/analyzerconstants.h

View File

@@ -1,13 +1,10 @@
if (WITH_TESTS)
set(TST_COMPONENT CppEditor)
endif()
add_qtc_plugin(Designer
CONDITION TARGET Qt5::DesignerComponents AND TARGET Qt5::Designer
DEPENDS designerintegrationv2
Qt5::Designer Qt5::PrintSupport Qt5::DesignerComponents
DEFINES CPP_ENABLED
PLUGIN_DEPENDS Core CppTools ProjectExplorer QtSupport ResourceEditor TextEditor ${TST_COMPONENT}
PLUGIN_DEPENDS Core CppTools ProjectExplorer QtSupport ResourceEditor TextEditor
PLUGIN_TEST_DEPENDS CppEditor
SOURCES
codemodelhelpers.cpp codemodelhelpers.h
cpp/formclasswizard.cpp cpp/formclasswizard.h

View File

@@ -1,9 +1,6 @@
if (WITH_TESTS)
set(TST_COMPONENT CppEditor CppTools)
endif()
add_qtc_plugin(FakeVim
PLUGIN_DEPENDS Core TextEditor ${TST_COMPONENT}
PLUGIN_DEPENDS Core TextEditor
PLUGIN_TEST_DEPENDS CppEditor CppTools
SOURCES ${TEST_SOURCES}
fakevim.qrc
fakevimactions.cpp fakevimactions.h

View File

@@ -1,9 +1,6 @@
if (WITH_TESTS)
set(TST_COMPONENT CppEditor)
endif()
add_qtc_plugin(GenericProjectManager
PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor ${TST_COMPONENT}
PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor
PLUGIN_TEST_DEPENDS CppEditor
PLUGIN_RECOMMENDS CppTools
SOURCES ${TEST_SOURCES}
filesselectionwizardpage.cpp filesselectionwizardpage.h

View File

@@ -471,7 +471,7 @@ GitPlugin::~GitPlugin()
void GitPluginPrivate::onApplySettings()
{
configurationChanged();
emit configurationChanged();
updateRepositoryBrowserAction();
bool gitFoundOk;
QString errorMessage;

View File

@@ -5,21 +5,7 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/litehtml/CMakeLists.txt)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# suppress warning about VERSION being overwritten or not
# and add subdirectory
set(ORIG_VERSION ${PROJECT_VERSION})
set(ORIG_MAJOR ${PROJECT_VERSION_MAJOR})
set(ORIG_MINOR ${PROJECT_VERSION_MINOR})
set(ORIG_PATCH ${PROJECT_VERSION_PATCH})
set(PROJECT_VERSION "")
set(PROJECT_VERSION_MAJOR "")
set(PROJECT_VERSION_MINOR "")
set(PROJECT_VERSION_PATCH "")
add_subdirectory(litehtml EXCLUDE_FROM_ALL)
set(PROJECT_VERSION ${ORIG_VERSION})
set(PROJECT_VERSION_MAJOR ${ORIG_MAJOR})
set(PROJECT_VERSION_MINOR ${ORIG_MINOR})
set(PROJECT_VERSION_PATCH ${ORIG_PATCH})
set(CMAKE_POSITION_INDEPENDENT_CODE "${ORIG_FPIC}")
# force optimized litehtml even in debug

View File

@@ -65,6 +65,7 @@ exists($$PWD/litehtml/CMakeLists.txt) {
$$LH_SRC/src/element.cpp \
$$LH_SRC/src/el_font.cpp \
$$LH_SRC/src/el_image.cpp \
$$LH_SRC/src/el_li.cpp \
$$LH_SRC/src/el_link.cpp \
$$LH_SRC/src/el_para.cpp \
$$LH_SRC/src/el_script.cpp \
@@ -79,6 +80,7 @@ exists($$PWD/litehtml/CMakeLists.txt) {
$$LH_SRC/src/html_tag.cpp \
$$LH_SRC/src/iterators.cpp \
$$LH_SRC/src/media_query.cpp \
$$LH_SRC/src/num_cvt.cpp \
$$LH_SRC/src/style.cpp \
$$LH_SRC/src/stylesheet.cpp \
$$LH_SRC/src/table.cpp \
@@ -108,6 +110,7 @@ exists($$PWD/litehtml/CMakeLists.txt) {
$$LH_HDR/el_div.h \
$$LH_HDR/el_font.h \
$$LH_HDR/el_image.h \
$$LH_HDR/el_li.h \
$$LH_HDR/el_link.h \
$$LH_HDR/el_para.h \
$$LH_HDR/el_script.h \
@@ -123,6 +126,7 @@ exists($$PWD/litehtml/CMakeLists.txt) {
$$LH_HDR/html_tag.h \
$$LH_HDR/iterators.h \
$$LH_HDR/media_query.h \
$$LH_HDR/num_cvt.h \
$$LH_HDR/os_types.h \
$$LH_HDR/style.h \
$$LH_HDR/stylesheet.h \

View File

@@ -136,6 +136,7 @@ Product {
"element.cpp",
"el_font.cpp",
"el_image.cpp",
"el_li.cpp",
"el_link.cpp",
"el_para.cpp",
"el_script.cpp",
@@ -150,6 +151,7 @@ Product {
"html_tag.cpp",
"iterators.cpp",
"media_query.cpp",
"num_cvt.cpp",
"style.cpp",
"stylesheet.cpp",
"table.cpp",
@@ -185,6 +187,7 @@ Product {
"el_div.h",
"el_font.h",
"el_image.h",
"el_li.h",
"el_link.h",
"el_para.h",
"el_script.h",
@@ -200,6 +203,7 @@ Product {
"html_tag.h",
"iterators.h",
"media_query.h",
"num_cvt.h",
"os_types.h",
"style.h",
"stylesheet.h",

View File

@@ -225,6 +225,9 @@ PropertyTreeItem::ValueType typeFrom(const QmlDesigner::QmlTimelineKeyframeGroup
std::vector<QString> parentIds(const QmlDesigner::ModelNode &node)
{
if (!node.hasParentProperty())
return {};
std::vector<QString> out;
QmlDesigner::ModelNode parent = node.parentProperty().parentModelNode();

View File

@@ -888,6 +888,7 @@ public:
, labelFlags(Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextDontClip)
, labelFlipSide(false)
, hitTesting(hitTest)
, events()
{
// width
if (node.modelNode().hasAuxiliaryData("width"))
@@ -952,6 +953,13 @@ public:
// label flip side
if (node.modelNode().hasAuxiliaryData("labelFlipSide"))
labelFlipSide = node.modelNode().auxiliaryData("labelFlipSide").toBool();
isSelected = node.modelNode().isSelected();
const char eventsName[] = "eventIds";
if (node.modelNode().hasVariantProperty(eventsName))
events = node.modelNode().variantProperty(eventsName).value().toString();
}
qreal width;
@@ -977,6 +985,8 @@ public:
int labelFlags;
bool labelFlipSide;
bool hitTesting;
bool isSelected;
QString events;
};
static bool verticalOverlap(const QRectF &from, const QRectF &to)
@@ -1453,6 +1463,35 @@ QPointF FormEditorTransitionItem::instancePosition() const
static void drawLabel(QPainter *painter, const Connection &connection)
{
// draw label with event ids
if (connection.config.isSelected && !connection.config.events.isEmpty())
{
qreal offset = connection.config.labelOffset;
QStringList events = connection.config.events.split(',');
int fontSize = connection.config.fontSize;
QString output = events[0].trimmed();
qreal minWidth = offset * 12;
int letterWidth = fontSize * 0.6; // assumption on max letter length
if (minWidth < output.size() * letterWidth) minWidth = output.size() * letterWidth;
int eventCount = events.size();
for (int i = 1; i < eventCount; ++i)
{
output.append('\n');
QString id = events[i].trimmed();
output.append(id);
if (minWidth < id.size() * letterWidth) minWidth = id.size() * letterWidth;
}
const QPointF pos = connection.path.pointAtPercent(0.0);
painter->save();
painter->setBrush(QColor(70, 70, 70, 200));
painter->setPen(Qt::lightGray);
painter->drawRoundedRect(pos.x(), pos.y() + offset, minWidth, 1.5 * fontSize * eventCount + offset * 4, offset / 2, offset / 2);
painter->drawText(pos.x(), pos.y() + 2 * offset, minWidth, offset * 2, Qt::AlignHCenter, QObject::tr("Connected Events"));
painter->drawLine(pos.x() + offset, pos.y() + 4 * offset, pos.x() + minWidth - offset, pos.y() + offset * 4);
painter->drawText(pos.x() + offset, pos.y() + 4 * offset, minWidth - offset, 1.5 * fontSize * eventCount, Qt::AlignLeft, output);
painter->restore();
}
if (connection.config.label.isEmpty())
return;

View File

@@ -379,7 +379,7 @@ void FormEditorView::nodeIdChanged(const ModelNode& node, const QString &/*newId
}
void FormEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &/*lastSelectedNodeList*/)
const QList<ModelNode> &lastSelectedNodeList)
{
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeListKeppInvalid(selectedNodeList)));
@@ -389,6 +389,23 @@ void FormEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeLi
m_formEditorWidget->zoomSelectionAction()->setEnabled(false);
else
m_formEditorWidget->zoomSelectionAction()->setEnabled(true);
for (const ModelNode &node : lastSelectedNodeList) { /*Set Z to 0 for unselected items */
QmlVisualNode visualNode(node); /* QmlVisualNode extends ModelNode with extra methods for "visual nodes" */
if (visualNode.isFlowTransition()) { /* Check if a QmlVisualNode Transition */
if (FormEditorItem *item = m_scene->itemForQmlItemNode(visualNode.toQmlItemNode())) { /* Get the form editor item from the form editor */
item->setZValue(0);
}
}
}
for (const ModelNode &node : selectedNodeList) {
QmlVisualNode visualNode(node);
if (visualNode.isFlowTransition()) {
if (FormEditorItem *item = m_scene->itemForQmlItemNode(visualNode.toQmlItemNode())) {
item->setZValue(11);
}
}
}
}
void FormEditorView::variantPropertiesChanged(const QList<VariantProperty> &propertyList,

View File

@@ -2,6 +2,7 @@
\"Name\" : \"WebAssembly\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"Experimental\" : true,
\"DisabledByDefault\" : true,
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",

View File

@@ -12,6 +12,20 @@ function foo(a, b) {
var foo = function (a, b) {}
const func1 = x => x * 2
const func2 = x => {
return x * 7
}
const func3 = (x, y) => x + y
const func4 = (x, y) => {
return x + y
}
const s1 = `test`
const s2 = `${42 * 1}`
const s3 = `test ${s2}`
const s4 = `${s2}${s3}test`
while (true) {
for (var a = 1; a < 5; ++a) {
switch (a) {