Merge "Merge remote-tracking branch 'origin/4.14'"

This commit is contained in:
The Qt Project
2020-12-10 13:34:38 +00:00
97 changed files with 1053 additions and 449 deletions

View File

@@ -1020,8 +1020,7 @@ FilePath AndroidConfig::defaultSdkPath()
// Set default path of SDK as used by Android Studio
if (Utils::HostOsInfo::isMacHost()) {
return Utils::FilePath::fromString(
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
+ "/../Android/sdk");
QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Android/sdk");
}
if (Utils::HostOsInfo::isWindowsHost()) {
@@ -1348,7 +1347,11 @@ void AndroidConfigurations::updateAutomaticKitList()
DeviceKitAspect::setDevice(k, device);
QStringList abis = static_cast<const AndroidQtVersion *>(qt)->androidAbis();
Debugger::DebuggerKitAspect::setDebugger(k, findOrRegisterDebugger(tc, abis, QtKitAspect::qtVersion(k)));
k->makeSticky();
k->setSticky(ToolChainKitAspect::id(), true);
k->setSticky(QtSupport::QtKitAspect::id(), true);
k->setSticky(DeviceKitAspect::id(), true);
k->setSticky(DeviceTypeKitAspect::id(), true);
QString versionStr = QLatin1String("Qt %{Qt:Version}");
if (!qt->isAutodetected())
@@ -1451,16 +1454,14 @@ AndroidConfigurations::~AndroidConfigurations() = default;
static Utils::FilePath androidStudioPath()
{
if (Utils::HostOsInfo::isWindowsHost()) {
const QLatin1String registryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio");
const QLatin1String valueName("Path");
#if defined(Q_OS_WIN)
const QSettings settings64(registryKey, QSettings::Registry64Format);
const QSettings settings32(registryKey, QSettings::Registry32Format);
return Utils::FilePath::fromUserInput(
settings64.value(valueName, settings32.value(valueName).toString()).toString());
#endif
}
#if defined(Q_OS_WIN)
const QLatin1String registryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio");
const QLatin1String valueName("Path");
const QSettings settings64(registryKey, QSettings::Registry64Format);
const QSettings settings32(registryKey, QSettings::Registry32Format);
return Utils::FilePath::fromUserInput(
settings64.value(valueName, settings32.value(valueName).toString()).toString());
#endif
return {}; // TODO non-Windows
}

View File

@@ -33,6 +33,7 @@
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchainmanager.h>
#include <qtsupport/qtkitinformation.h>
@@ -318,7 +319,10 @@ bool CMakeProjectImporter::matchKit(void *directoryData, const Kit *k) const
if (data->qt.qt && QtSupport::QtKitAspect::qtVersionId(k) != data->qt.qt->uniqueId())
return false;
const QList<Id> allLanguages = ToolChainManager::allLanguages();
for (const ToolChainDescription &tcd : data->toolChains) {
if (!Utils::contains(allLanguages, [&tcd](const Id& language) {return language == tcd.language;}))
continue;
ToolChain *tc = ToolChainKitAspect::toolChain(k, tcd.language);
if (!tc || tc->compilerCommand() != tcd.compilerPath)
return false;

View File

@@ -637,7 +637,7 @@ QWidget *ICore::dialogParent()
QWidget *active = QApplication::activeModalWidget();
if (!active)
active = QApplication::activeWindow();
if (!active)
if (!active || (active && active->windowFlags().testFlag(Qt::SplashScreen)))
active = m_mainwindow;
return active;
}

View File

@@ -31,7 +31,6 @@ namespace Internal {
namespace Constants {
const QLatin1String CUSTOMCOMMANDBUILDER_COMMAND("IncrediBuild.BuildConsole.%1.Command");
const QLatin1String CUSTOMCOMMANDBUILDER_ARGS("IncrediBuild.BuildConsole.%1.Arguments");
const QLatin1String CUSTOMCOMMANDBUILDER_ARGSSET("IncrediBuild.BuildConsole.%1.ArgumentsSet");
} // namespace Constants
void CommandBuilder::fromMap(const QVariantMap &map)

View File

@@ -39,6 +39,7 @@ const char KIT_MCUTARGET_SDKVERSION_KEY[] = "McuSupport.McuTargetSdkVersion";
const char KIT_MCUTARGET_KITVERSION_KEY[] = "McuSupport.McuTargetKitVersion";
const char KIT_MCUTARGET_COLORDEPTH_KEY[] = "McuSupport.McuTargetColorDepth";
const char KIT_MCUTARGET_OS_KEY[] = "McuSupport.McuTargetOs";
const char KIT_MCUTARGET_TOOCHAIN_KEY[] = "McuSupport.McuTargetToolchain";
const char SETTINGS_GROUP[] = "McuSupport";
const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_";

View File

@@ -65,7 +65,7 @@ using namespace Utils;
namespace McuSupport {
namespace Internal {
static const int KIT_VERSION = 7; // Bumps up whenever details in Kit creation change
static const int KIT_VERSION = 8; // Bumps up whenever details in Kit creation change
static QString packagePathFromSettings(const QString &settingsKey,
QSettings::Scope scope = QSettings::UserScope,
@@ -577,6 +577,7 @@ static void setKitProperties(const QString &kitName, Kit *k, const McuTarget *mc
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, mcuTarget->qulVersion().toString());
k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
k->setValue(KIT_MCUTARGET_TOOCHAIN_KEY, mcuTarget->toolChainPackage()->toolChainName());
k->setAutoDetected(true);
k->makeSticky();
if (mcuTarget->toolChainPackage()->isDesktopToolchain())
@@ -741,6 +742,8 @@ QList<Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
&& kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth()
&& kit->value(KIT_MCUTARGET_OS_KEY).toInt()
== static_cast<int>(mcuTarget->os())
&& kit->value(KIT_MCUTARGET_TOOCHAIN_KEY)
== mcuTarget->toolChainPackage()->toolChainName()
));
});
}

View File

@@ -59,7 +59,6 @@ using namespace Utils;
const char BUILD_TARGETS_SUFFIX[] = ".BuildTargets";
const char MAKE_ARGUMENTS_SUFFIX[] = ".MakeArguments";
const char MAKE_COMMAND_SUFFIX[] = ".MakeCommand";
const char CLEAN_SUFFIX[] = ".Clean";
const char OVERRIDE_MAKEFLAGS_SUFFIX[] = ".OverrideMakeflags";
const char JOBCOUNT_SUFFIX[] = ".JobCount";

View File

@@ -3903,7 +3903,7 @@ void ProjectExplorerPlugin::addCustomParser(const CustomParserSettings &settings
void ProjectExplorerPlugin::removeCustomParser(Id id)
{
erase(dd->m_customParsers, [id](const CustomParserSettings &s) {
Utils::erase(dd->m_customParsers, [id](const CustomParserSettings &s) {
return s.id == id;
});
emit m_instance->customParsersChanged();

View File

@@ -272,11 +272,7 @@ QString QbsBuildConfiguration::configurationName() const
QString QbsBuildConfiguration::equivalentCommandLine(const QbsBuildStepData &stepData) const
{
CommandLine commandLine;
const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR"));
const QString qbsFilePath = HostOsInfo::withExecutableSuffix(!qbsInstallDir.isEmpty()
? qbsInstallDir + QLatin1String("/bin/qbs")
: QCoreApplication::applicationDirPath() + QLatin1String("/qbs"));
commandLine.addArg(QDir::toNativeSeparators(qbsFilePath));
commandLine.addArg(QDir::toNativeSeparators(QbsSettings::qbsExecutableFilePath().toString()));
commandLine.addArg(stepData.command);
const QString buildDir = buildDirectory().toUserOutput();
commandLine.addArgs({"-d", buildDir});

View File

@@ -786,7 +786,9 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
cFlags = cxxFlags = commonFlags;
const auto cxxLanguageVersion = arrayToStringList(getCppProp("cxxLanguageVersion"));
if (cxxLanguageVersion.contains("c++17"))
if (cxxLanguageVersion.contains("c++20"))
cxxFlags << "-std=c++20";
else if (cxxLanguageVersion.contains("c++17"))
cxxFlags << "-std=c++17";
else if (cxxLanguageVersion.contains("c++14"))
cxxFlags << "-std=c++14";
@@ -805,7 +807,11 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
cxxFlags << QLatin1String(enableRtti.toBool() ? "-frtti" : "-fno-rtti");
const auto cLanguageVersion = arrayToStringList(getCppProp("cLanguageVersion"));
if (cLanguageVersion.contains("c11"))
if (cLanguageVersion.contains("c18"))
cFlags << "-cstd=c18";
else if (cLanguageVersion.contains("c17"))
cFlags << "-std=c17";
else if (cLanguageVersion.contains("c11"))
cFlags << "-std=c11";
else if (cLanguageVersion.contains("c99"))
cFlags << "-std=c99";

View File

@@ -57,7 +57,7 @@ void BindingModel::resetModel()
QStringList({tr("Item"), tr("Property"), tr("Source Item"), tr("Source Property")}));
if (connectionView()->isAttached()) {
for (const ModelNode modelNode : connectionView()->selectedModelNodes())
for (const ModelNode &modelNode : connectionView()->selectedModelNodes())
addModelNode(modelNode);
}

View File

@@ -49,7 +49,7 @@ namespace {
QStringList propertyNameListToStringList(const QmlDesigner::PropertyNameList &propertyNameList)
{
QStringList stringList;
for (const QmlDesigner::PropertyName propertyName : propertyNameList) {
for (const QmlDesigner::PropertyName &propertyName : propertyNameList) {
stringList << QString::fromUtf8(propertyName);
}
stringList.removeDuplicates();

View File

@@ -134,7 +134,7 @@ void DynamicPropertiesModel::resetModel()
QStringList({tr("Item"), tr("Property"), tr("Property Type"), tr("Property Value")}));
if (connectionView()->isAttached()) {
for (const ModelNode modelNode : connectionView()->selectedModelNodes())
for (const ModelNode &modelNode : connectionView()->selectedModelNodes())
addModelNode(modelNode);
}

View File

@@ -44,6 +44,7 @@ Edit3DCanvas::Edit3DCanvas(Edit3DWidget *parent)
{
setMouseTracking(true);
setAcceptDrops(true);
setFocusPolicy(Qt::ClickFocus);
}
void Edit3DCanvas::updateRenderImage(const QImage &img)

View File

@@ -484,6 +484,8 @@ void ItemLibraryWidget::addImport(const QString &name, const QString &version)
void ItemLibraryWidget::addPossibleImport(const QString &name)
{
QTC_ASSERT(m_model, return);
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_IMPORT_ADDED_FLOWTAG
+ name);
const Import import = m_model->highestPossibleImport(name);
try {
QList<Import> addedImports = {Import::createLibraryImport(name, import.version())};

View File

@@ -126,7 +126,7 @@ public:
}
}
void walCheckpointFull()
void walCheckpointFull() override
{
try {
database.walCheckpointFull();

View File

@@ -39,10 +39,13 @@
#include <QPointer>
#include <QRectF>
#include <QTime>
#include <QTimer>
#include <QtGui/qevent.h>
#include <memory>
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
namespace ProjectExplorer {
class Target;
}
@@ -219,6 +222,8 @@ private: // functions
QVariant modelNodePreviewImageDataToVariant(const ModelNodePreviewImageData &imageData);
void updatePreviewImageForNode(const ModelNode &modelNode, const QImage &image);
void updateWatcher(const QString &path);
private:
QHash<QString, ModelNodePreviewImageData> m_imageDataMap;
@@ -236,7 +241,16 @@ private:
// key: fileUrl value: (key: instance qml id, value: related tool states)
QHash<QUrl, QHash<QString, QVariantMap>> m_edit3DToolStates;
std::function<void()> m_crashCallback{[this] { handleCrash(); }};
// We use QFileSystemWatcher directly instead of Utils::FileSystemWatcher as we want
// shader changes to be applied immediately rather than requiring reactivation of
// the creator application.
QFileSystemWatcher *m_fileSystemWatcher;
QTimer m_resetTimer;
QTimer m_updateWatcherTimer;
QSet<QString> m_pendingUpdateDirs;
};
} // namespace ProxyNodeInstanceView

View File

@@ -190,6 +190,7 @@ protected: // functions
private: //variables
ModelNode nodeAtTextCursorPositionHelper(const ModelNode &root, int cursorPosition) const;
void setupCanonicalHashes() const;
void handleLibraryInfoUpdate();
TextModifier *m_textModifier = nullptr;
int transactionLevel = 0;
@@ -210,6 +211,7 @@ private: //variables
std::function<void(bool)> m_setWidgetStatusCallback;
bool m_hasIncompleteTypeInformation = false;
bool m_restoringAuxData = false;
bool m_modelAttachPending = false;
mutable QHash<int, ModelNode> m_canonicalIntModelNode;
mutable QHash<ModelNode, int> m_canonicalModelNodeInt;

View File

@@ -100,6 +100,7 @@
#include <QTimerEvent>
#include <QPicture>
#include <QPainter>
#include <QDirIterator>
enum {
debug = false
@@ -135,8 +136,44 @@ NodeInstanceView::NodeInstanceView(ConnectionManagerInterface &connectionManager
: m_connectionManager(connectionManager)
, m_baseStatePreviewImage(QSize(100, 100), QImage::Format_ARGB32)
, m_restartProcessTimerId(0)
, m_fileSystemWatcher(new QFileSystemWatcher(this))
{
m_baseStatePreviewImage.fill(0xFFFFFF);
// Interval > 0 is used for QFileSystemWatcher related timers to allow all notifications
// related to a single event to be received before we act.
m_resetTimer.setSingleShot(true);
m_resetTimer.setInterval(100);
QObject::connect(&m_resetTimer, &QTimer::timeout, [this] {
resetPuppet();
});
m_updateWatcherTimer.setSingleShot(true);
m_updateWatcherTimer.setInterval(100);
QObject::connect(&m_updateWatcherTimer, &QTimer::timeout, [this] {
for (const auto &path : qAsConst(m_pendingUpdateDirs))
updateWatcher(path);
m_pendingUpdateDirs.clear();
});
connect(m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged,
[this](const QString &path) {
const QSet<QString> pendingDirs = m_pendingUpdateDirs;
for (const auto &pendingPath : pendingDirs) {
if (path.startsWith(pendingPath)) {
// no need to add path, already handled by a pending parent path
return;
} else if (pendingPath.startsWith(path)) {
// Parent path to a pending path added, remove the pending path
m_pendingUpdateDirs.remove(pendingPath);
}
}
m_pendingUpdateDirs.insert(path);
m_updateWatcherTimer.start();
});
connect(m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, [this] {
m_resetTimer.start();
});
}
@@ -210,6 +247,8 @@ void NodeInstanceView::modelAttached(Model *model)
NodeInstance newStateInstance = instanceForModelNode(stateNode);
activateState(newStateInstance);
}
updateWatcher({});
}
void NodeInstanceView::modelAboutToBeDetached(Model * model)
@@ -227,6 +266,11 @@ void NodeInstanceView::modelAboutToBeDetached(Model * model)
m_activeStateInstance = NodeInstance();
m_rootNodeInstance = NodeInstance();
AbstractView::modelAboutToBeDetached(model);
m_resetTimer.stop();
m_updateWatcherTimer.stop();
m_pendingUpdateDirs.clear();
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->directories());
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->files());
}
void NodeInstanceView::handleCrash()
@@ -378,6 +422,7 @@ void NodeInstanceView::resetVerticalAnchors(const ModelNode &modelNode)
void NodeInstanceView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList)
{
QTC_ASSERT(m_nodeInstanceServer, return);
QList<ModelNode> nodeList;
QList<AbstractProperty> nonNodePropertyList;
@@ -449,6 +494,7 @@ void NodeInstanceView::nodeTypeChanged(const ModelNode &, const TypeName &, int,
void NodeInstanceView::bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
{
QTC_ASSERT(m_nodeInstanceServer, return);
m_nodeInstanceServer->changePropertyBindings(createChangeBindingCommand(propertyList));
}
@@ -463,6 +509,7 @@ void NodeInstanceView::bindingPropertiesChanged(const QList<BindingProperty>& pr
void NodeInstanceView::variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
{
QTC_ASSERT(m_nodeInstanceServer, return);
updatePosition(propertyList);
m_nodeInstanceServer->changePropertyValues(createChangeValueCommand(propertyList));
}
@@ -478,6 +525,7 @@ void NodeInstanceView::variantPropertiesChanged(const QList<VariantProperty>& pr
void NodeInstanceView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
QTC_ASSERT(m_nodeInstanceServer, return);
if (!isSkippedNode(node)) {
updateChildren(newPropertyParent);
m_nodeInstanceServer->reparentInstances(
@@ -487,11 +535,14 @@ void NodeInstanceView::nodeReparented(const ModelNode &node, const NodeAbstractP
void NodeInstanceView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &newUrl)
{
QTC_ASSERT(m_nodeInstanceServer, return);
m_nodeInstanceServer->changeFileUrl(createChangeFileUrlCommand(newUrl));
}
void NodeInstanceView::nodeIdChanged(const ModelNode& node, const QString& /*newId*/, const QString &oldId)
{
QTC_ASSERT(m_nodeInstanceServer, return);
if (hasInstanceForModelNode(node)) {
NodeInstance instance = instanceForModelNode(node);
m_nodeInstanceServer->changeIds(createChangeIdsCommand({instance}));
@@ -502,6 +553,7 @@ void NodeInstanceView::nodeIdChanged(const ModelNode& node, const QString& /*new
void NodeInstanceView::nodeOrderChanged(const NodeListProperty & listProperty,
const ModelNode & /*movedNode*/, int /*oldIndex*/)
{
QTC_ASSERT(m_nodeInstanceServer, return);
QVector<ReparentContainer> containerList;
PropertyName propertyName = listProperty.name();
qint32 containerInstanceId = -1;
@@ -530,6 +582,7 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node,
const PropertyName &name,
const QVariant &value)
{
QTC_ASSERT(m_nodeInstanceServer, return);
if (((node.isRootNode() && (name == "width" || name == "height")) || name == "invisible" || name == "locked")
|| name.endsWith(PropertyName("@NodeInstance"))) {
if (hasInstanceForModelNode(node)) {
@@ -566,6 +619,7 @@ void NodeInstanceView::customNotification(const AbstractView *view, const QStrin
void NodeInstanceView::nodeSourceChanged(const ModelNode &node, const QString & newNodeSource)
{
QTC_ASSERT(m_nodeInstanceServer, return);
if (hasInstanceForModelNode(node)) {
NodeInstance instance = instanceForModelNode(node);
ChangeNodeSourceCommand changeNodeSourceCommand(instance.instanceId(), newNodeSource);
@@ -1704,4 +1758,61 @@ void NodeInstanceView::updatePreviewImageForNode(const ModelNode &modelNode, con
emitModelNodelPreviewPixmapChanged(modelNode, pixmap);
}
void NodeInstanceView::updateWatcher(const QString &path)
{
QString rootPath;
QStringList oldFiles;
QStringList oldDirs;
QStringList newFiles;
QStringList newDirs;
if (path.isEmpty()) {
// Do full update
rootPath = QFileInfo(model()->fileUrl().toLocalFile()).absolutePath();
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->directories());
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->files());
} else {
rootPath = path;
const QStringList files = m_fileSystemWatcher->files();
const QStringList dirs = m_fileSystemWatcher->directories();
for (const auto &file : files) {
if (file.startsWith(path))
oldFiles.append(file);
}
for (const auto &dir : dirs) {
if (dir.startsWith(path))
oldDirs.append(dir);
}
}
newDirs.append(rootPath);
QDirIterator dirIterator(rootPath, {}, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
while (dirIterator.hasNext())
newDirs.append(dirIterator.next());
// Common shader suffixes
static const QStringList filterList {"*.frag", "*.vert",
"*.glsl", "*.glslv", "*.glslf",
"*.vsh","*.fsh"};
QDirIterator fileIterator(rootPath, filterList, QDir::Files, QDirIterator::Subdirectories);
while (fileIterator.hasNext())
newFiles.append(fileIterator.next());
if (oldDirs != newDirs) {
if (!oldDirs.isEmpty())
m_fileSystemWatcher->removePaths(oldDirs);
if (!newDirs.isEmpty())
m_fileSystemWatcher->addPaths(newDirs);
}
if (newFiles != oldFiles) {
if (!oldFiles.isEmpty())
m_fileSystemWatcher->removePaths(oldFiles);
if (!newFiles.isEmpty())
m_fileSystemWatcher->addPaths(newFiles);
}
}
}

View File

@@ -837,7 +837,7 @@ ModelNode QmlFlowItemNode::decisionNodeForTransition(const ModelNode &transition
}
QmlFlowViewNode flowView(transition.view()->rootModelNode());
if (flowView.isValid()) {
for (const ModelNode target : flowView.decicions()) {
for (const ModelNode &target : flowView.decicions()) {
if (target.hasBindingProperty("targets")
&& target.bindingProperty("targets").resolveToModelNodeList().contains(transition))
return target;
@@ -853,7 +853,7 @@ ModelNode QmlFlowTargetNode::findSourceForDecisionNode() const
if (!isFlowDecision())
return {};
for (const ModelNode transition : flowView().transitionsForTarget(modelNode())) {
for (const ModelNode &transition : flowView().transitionsForTarget(modelNode())) {
if (transition.hasBindingProperty("from")) {
const ModelNode source = transition.bindingProperty("from").resolveToModelNode();
if (source.isValid()) {

View File

@@ -64,6 +64,19 @@ namespace QmlDesigner {
const char annotationsEscapeSequence[] = "##^##";
bool debugQmlPuppet()
{
#ifndef QMLDESIGNER_TEST
if (!QmlDesignerPlugin::instance())
return false;
const QString debugPuppet = QmlDesignerPlugin::instance()->settings().value(DesignerSettingsKey::
DEBUG_PUPPET).toString();
return !debugPuppet.isEmpty();
#else
return false;
#endif
}
RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *parent):
AbstractView(parent),
m_differenceHandling(differenceHandling),
@@ -72,7 +85,12 @@ RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *paren
m_textToModelMerger(new Internal::TextToModelMerger(this))
{
m_amendTimer.setSingleShot(true);
m_amendTimer.setInterval(400);
connect(&m_amendTimer, &QTimer::timeout, this, &RewriterView::amendQmlText);
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
connect(modelManager, &QmlJS::ModelManagerInterface::libraryInfoUpdated,
this, &RewriterView::handleLibraryInfoUpdate, Qt::QueuedConnection);
}
RewriterView::~RewriterView() = default;
@@ -89,6 +107,8 @@ Internal::TextToModelMerger *RewriterView::textToModelMerger() const
void RewriterView::modelAttached(Model *model)
{
m_modelAttachPending = false;
if (model && model->textModifier())
setTextModifier(model->textModifier());
@@ -102,10 +122,12 @@ void RewriterView::modelAttached(Model *model)
if (!(m_errors.isEmpty() && m_warnings.isEmpty()))
notifyErrorsAndWarnings(m_errors);
if (hasIncompleteTypeInformation())
if (hasIncompleteTypeInformation()) {
m_modelAttachPending = true;
QTimer::singleShot(1000, this, [this, model](){
modelAttached(model);
});
}
}
void RewriterView::modelAboutToBeDetached(Model * /*model*/)
@@ -803,6 +825,13 @@ void RewriterView::setupCanonicalHashes() const
}
}
void RewriterView::handleLibraryInfoUpdate()
{
// Trigger dummy amend to reload document when library info changes
if (isAttached() && !m_modelAttachPending && !debugQmlPuppet())
m_amendTimer.start();
}
ModelNode RewriterView::nodeAtTextCursorPosition(int cursorPosition) const
{
return nodeAtTextCursorPositionHelper(rootModelNode(), cursorPosition);
@@ -1005,7 +1034,7 @@ void RewriterView::qmlTextChanged()
auto &viewManager = QmlDesignerPlugin::instance()->viewManager();
if (viewManager.usesRewriterView(this)) {
QmlDesignerPlugin::instance()->viewManager().disableWidgets();
m_amendTimer.start(400);
m_amendTimer.start();
}
#else
/*Keep test synchronous*/

View File

@@ -1672,7 +1672,7 @@ void ModelValidator::signalHandlerSourceDiffer(SignalHandlerProperty &modelPrope
{
Q_UNUSED(modelProperty)
Q_UNUSED(javascript)
QTC_ASSERT(modelProperty.source() == javascript, return);
QTC_ASSERT(compareJavaScriptExpression(modelProperty.source(), javascript), return);
}
void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString & /*javascript*/)

View File

@@ -86,6 +86,7 @@ const char EVENT_ANNOTATION_ADDED[] = "Annotation Added";
const char EVENT_RESOURCE_IMPORTED[] = "Resource Imported ";
const char EVENT_ACTION_EXECUTED[] = "Action Executed ";
const char EVENT_IMPORT_ADDED[] = "Import Added ";
const char EVENT_IMPORT_ADDED_FLOWTAG[] = "Import Added FlowTag ";
const char EVENT_BINDINGEDITOR_OPENED[] = "Binding Editor Opened";
const char EVENT_RICHTEXT_OPENED[] = "Richtext Editor Opened";
const char EVENT_FORMEDITOR_TIME[] = "Form Editor";

View File

@@ -34,16 +34,6 @@
using namespace ProjectExplorer;
using namespace QtSupport;
static QString format(const QString &fileName, int lineNo, const QString &msg)
{
if (lineNo > 0)
return QString::fromLatin1("%1(%2): %3").arg(fileName, QString::number(lineNo), msg);
else if (lineNo)
return QString::fromLatin1("%1: %3").arg(fileName, msg);
else
return msg;
}
ProMessageHandler::ProMessageHandler(bool verbose, bool exact)
: m_verbose(verbose)
, m_exact(exact)

View File

@@ -90,7 +90,7 @@ void RsyncDeployService::doDeploy()
void RsyncDeployService::filterDeployableFiles() const
{
if (m_ignoreMissingFiles) {
erase(m_deployableFiles, [](const DeployableFile &f) {
Utils::erase(m_deployableFiles, [](const DeployableFile &f) {
return !f.localFilePath().exists();
});
}

View File

@@ -345,7 +345,7 @@ WelcomeMode::WelcomeMode()
setPriority(Core::Constants::P_MODE_WELCOME);
setId(Core::Constants::MODE_WELCOME);
setContextHelp("Qt Creator Manual");
setContextHelp("Qt Design Studio Manual");
setContext(Core::Context(Core::Constants::C_WELCOME_MODE));
m_modeWidget = new QQuickWidget;