Merge remote-tracking branch 'origin/4.6'

Conflicts:
	src/plugins/cmakeprojectmanager/cmakeproject.h
	src/plugins/debugger/debuggerplugin.cpp
	src/plugins/ios/iosrunfactories.cpp
	src/plugins/nim/project/nimproject.h
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
	src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
	src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
	src/plugins/qmlprojectmanager/qmlproject.h
	src/plugins/qnx/qnxrunconfigurationfactory.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp
	src/plugins/winrt/winrtrunfactories.cpp

Change-Id: Ib029fdbaa65270426332f5edd6e90264be5fb539
This commit is contained in:
Eike Ziller
2018-03-13 11:25:38 +01:00
74 changed files with 2241 additions and 912 deletions

View File

@@ -1,5 +1,5 @@
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
--- a/tools/clang/include/clang/Sema/Sema.h
+++ b/tools/clang/include/clang/Sema/Sema.h
@@ -2707,7 +2707,8 @@
OverloadCandidateSet &CandidateSet,
TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
@@ -10,8 +10,8 @@
void AddMethodCandidate(DeclAccessPair FoundDecl,
QualType ObjectType,
Expr::Classification ObjectClassification,
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
--- a/tools/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/tools/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4396,9 +4396,11 @@
ArgExprs.append(Args.begin(), Args.end());
UnresolvedSet<8> Decls;
@@ -25,8 +25,8 @@
} else {
FunctionDecl *FD = nullptr;
if (auto MCE = dyn_cast<MemberExpr>(NakedFn))
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
--- a/tools/clang/lib/Sema/SemaOverload.cpp
+++ b/tools/clang/lib/Sema/SemaOverload.cpp
@@ -6343,24 +6343,36 @@
OverloadCandidateSet& CandidateSet,
TemplateArgumentListInfo *ExplicitTemplateArgs,
@@ -72,8 +72,8 @@
SuppressUserConversions, PartialOverloading);
}
} else {
--- a/test/Index/complete-call.cpp
+++ b/test/Index/complete-call.cpp
--- a/tools/clang/test/Index/complete-call.cpp
+++ b/tools/clang/test/Index/complete-call.cpp
@@ -94,6 +94,24 @@
s.foo_7(42,);
}

View File

@@ -1,8 +1,8 @@
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
diff --git a/tools/clang/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 1b07ec60ce..46ed08d1cf 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -6371,57 +6371,54 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns,
--- a/tools/clang/lib/Sema/SemaOverload.cpp
+++ b/tools/clang/lib/Sema/SemaOverload.cpp
@@ -6321,57 +6321,56 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns,
bool FirstArgumentIsBase) {
for (UnresolvedSetIterator F = Fns.begin(), E = Fns.end(); F != E; ++F) {
NamedDecl *D = F.getDecl()->getUnderlyingDecl();
@@ -56,8 +56,7 @@ index 1b07ec60ce..46ed08d1cf 100644
+ Expr::Classification ObjectClassification;
+ if (Args.size() > 0) {
if (Expr *E = Args[0]) {
- // Use the explit base to restrict the lookup:
+ // Use the explicit base to restrict the lookup:
// Use the explit base to restrict the lookup:
ObjectType = E->getType();
ObjectClassification = E->Classify(Context);
} // .. else there is an implit base.
@@ -65,19 +64,17 @@ index 1b07ec60ce..46ed08d1cf 100644
+ }
+ if (IsTemplate)
AddMethodTemplateCandidate(
- FunTmpl, F.getPair(),
- cast<CXXRecordDecl>(FunTmpl->getDeclContext()),
- ExplicitTemplateArgs, ObjectType, ObjectClassification,
FunTmpl, F.getPair(),
cast<CXXRecordDecl>(FunTmpl->getDeclContext()),
ExplicitTemplateArgs, ObjectType, ObjectClassification,
- Args.slice(1), CandidateSet, SuppressUserConversions,
- PartialOverloading);
+ FunctionArgs, CandidateSet, SuppressUserConversions,
PartialOverloading);
- } else {
- AddTemplateOverloadCandidate(FunTmpl, F.getPair(),
- ExplicitTemplateArgs, Args,
- CandidateSet, SuppressUserConversions,
- PartialOverloading);
+ FunTmpl, F.getPair(), cast<CXXRecordDecl>(FD), ExplicitTemplateArgs,
+ ObjectType, ObjectClassification, FunctionArgs, CandidateSet,
+ SuppressUserConversions, PartialOverloading);
+ else
+ AddMethodCandidate(cast<CXXMethodDecl>(FD), F.getPair(),
+ cast<CXXMethodDecl>(FD)->getParent(), ObjectType,
@@ -102,10 +99,10 @@ index 1b07ec60ce..46ed08d1cf 100644
}
}
}
diff --git a/test/Index/complete-call.cpp b/test/Index/complete-call.cpp
diff --git a/tools/clang/test/Index/complete-call.cpp b/test/Index/complete-call.cpp
index ca116485ac..35f2009066 100644
--- a/test/Index/complete-call.cpp
+++ b/test/Index/complete-call.cpp
--- a/tools/clang/test/Index/complete-call.cpp
+++ b/tools/clang/test/Index/complete-call.cpp
@@ -112,6 +112,33 @@ struct Bar2 : public Bar {
}
};

View File

@@ -13,6 +13,7 @@ Module {
Depends { name: "vcs"; condition: hasVcs }
Properties {
condition: hasVcs
vcs.headerFileName: undefined
vcs.repoDir: {
// TODO: Could something like this be incorporated into the vcs module?
// Currently, the default repo dir is project.sourceDirectory, which

View File

@@ -44,9 +44,24 @@ InstanceContainer::InstanceContainer()
{
}
InstanceContainer::InstanceContainer(qint32 instanceId, const TypeName &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType, NodeMetaType metaType)
: m_instanceId(instanceId), m_type(properDelemitingOfType(type)), m_majorNumber(majorNumber), m_minorNumber(minorNumber), m_componentPath(componentPath),
m_nodeSource(nodeSource), m_nodeSourceType(nodeSourceType), m_metaType(metaType)
InstanceContainer::InstanceContainer(qint32 instanceId,
const TypeName &type,
int majorNumber,
int minorNumber,
const QString &componentPath,
const QString &nodeSource,
NodeSourceType nodeSourceType,
NodeMetaType metaType,
NodeFlags metaFlags)
: m_instanceId(instanceId)
,m_type(properDelemitingOfType(type))
,m_majorNumber(majorNumber)
,m_minorNumber(minorNumber)
,m_componentPath(componentPath)
,m_nodeSource(nodeSource)
,m_nodeSourceType(nodeSourceType)
,m_metaType(metaType)
,m_metaFlags(metaFlags)
{
}
@@ -90,6 +105,16 @@ InstanceContainer::NodeMetaType InstanceContainer::metaType() const
return static_cast<NodeMetaType>(m_metaType);
}
InstanceContainer::NodeFlags InstanceContainer::metaFlags() const
{
return NodeFlags(m_metaFlags);
}
bool InstanceContainer::checkFlag(NodeFlag flag) const
{
return NodeFlags(m_metaFlags).testFlag(flag);
}
QDataStream &operator<<(QDataStream &out, const InstanceContainer &container)
{
out << container.instanceId();
@@ -100,6 +125,7 @@ QDataStream &operator<<(QDataStream &out, const InstanceContainer &container)
out << container.nodeSource();
out << qint32(container.nodeSourceType());
out << qint32(container.metaType());
out << qint32(container.metaFlags());
return out;
}
@@ -115,6 +141,7 @@ QDataStream &operator>>(QDataStream &in, InstanceContainer &container)
in >> container.m_nodeSource;
in >> container.m_nodeSourceType;
in >> container.m_metaType;
in >> container.m_metaFlags;
return in;
}

View File

@@ -54,8 +54,22 @@ public:
ItemMetaType
};
enum NodeFlag {
ParentTakesOverRendering = 1
};
Q_DECLARE_FLAGS(NodeFlags, NodeFlag)
InstanceContainer();
InstanceContainer(qint32 instanceId, const TypeName &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType, NodeMetaType metaType);
InstanceContainer(qint32 instanceId,
const TypeName &type,
int majorNumber,
int minorNumber,
const QString &componentPath,
const QString &nodeSource,
NodeSourceType nodeSourceType,
NodeMetaType metaType,
NodeFlags metaFlags);
qint32 instanceId() const;
TypeName type() const;
@@ -65,6 +79,8 @@ public:
QString nodeSource() const;
NodeSourceType nodeSourceType() const;
NodeMetaType metaType() const;
bool checkFlag(NodeFlag flag) const;
NodeFlags metaFlags() const;
private:
qint32 m_instanceId = -1;
@@ -75,6 +91,7 @@ private:
QString m_nodeSource;
qint32 m_nodeSourceType = 0;
qint32 m_metaType = 0;
qint32 m_metaFlags = 0;
};
QDebug operator <<(QDebug debug, const InstanceContainer &command);
@@ -82,3 +99,4 @@ QDebug operator <<(QDebug debug, const InstanceContainer &command);
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::InstanceContainer)
Q_DECLARE_OPERATORS_FOR_FLAGS(QmlDesigner::InstanceContainer::NodeFlags)

View File

@@ -126,7 +126,8 @@ void ObjectNodeInstance::initializePropertyWatcher(const ObjectNodeInstance::Poi
m_signalSpy.setObjectNodeInstance(objectNodeInstance);
}
void ObjectNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance)
void ObjectNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags /*flags*/)
{
initializePropertyWatcher(objectNodeInstance);
QmlPrivateGate::registerNodeInstanceMetaObject(objectNodeInstance->object(), objectNodeInstance->nodeInstanceServer()->engine());

View File

@@ -28,6 +28,8 @@
#include "nodeinstanceserver.h"
#include "nodeinstancesignalspy.h"
#include "instancecontainer.h"
#include <QPainter>
#include <QSharedPointer>
#include <QWeakPointer>
@@ -78,7 +80,7 @@ public:
NodeInstanceServer *nodeInstanceServer() const;
void setNodeInstanceServer(NodeInstanceServer *server);
virtual void initialize(const Pointer &objectNodeInstance);
virtual void initialize(const Pointer &objectNodeInstance, InstanceContainer::NodeFlags flags);
virtual QImage renderImage() const;
virtual QImage renderPreviewImage(const QSize &previewImageSize) const;

View File

@@ -156,7 +156,8 @@ void QuickItemNodeInstance::createEffectItem(bool createEffectItem)
s_createEffectItem = createEffectItem;
}
void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance)
void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags)
{
if (instanceId() == 0) {
@@ -167,10 +168,11 @@ void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &object
if (quickItem()->window()) {
if (s_createEffectItem || instanceId() == 0)
designerSupport()->refFromEffectItem(quickItem());
designerSupport()->refFromEffectItem(quickItem(),
!flags.testFlag(InstanceContainer::ParentTakesOverRendering));
}
ObjectNodeInstance::initialize(objectNodeInstance);
ObjectNodeInstance::initialize(objectNodeInstance, flags);
quickItem()->update();
}

View File

@@ -46,7 +46,8 @@ public:
static Pointer create(QObject *objectToBeWrapped);
static void createEffectItem(bool createEffectItem);
void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance) override;
void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags) override;
QQuickItem *contentItem() const override;
bool hasContent() const override;

View File

@@ -188,7 +188,9 @@ Internal::ObjectNodeInstance::Pointer ServerNodeInstance::createInstance(QObject
return instance;
}
ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceServer, const InstanceContainer &instanceContainer, ComponentWrap componentWrap)
ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceServer,
const InstanceContainer &instanceContainer,
ComponentWrap componentWrap)
{
Q_ASSERT(instanceContainer.instanceId() != -1);
Q_ASSERT(nodeInstanceServer);
@@ -229,7 +231,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
instance.internalInstance()->setInstanceId(instanceContainer.instanceId());
instance.internalInstance()->initialize(instance.m_nodeInstance);
instance.internalInstance()->initialize(instance.m_nodeInstance, instanceContainer.metaFlags());
return instance;
}

View File

@@ -13,9 +13,9 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
**/
var FileInfo = loadExtension("qbs.FileInfo")
var FileInfo = require("qbs.FileInfo")
function getGTestDir(str) {
function getGTestDir(qbs, str) {
if (!str) {
if (qbs.hostOS.contains("linux"))
return "/usr/include/gtest";
@@ -25,7 +25,7 @@ function getGTestDir(str) {
return "";
}
function getGMockDir(str) {
function getGMockDir(qbs, str) {
if (!str) {
if (qbs.hostOS.contains("linux"))
return "/usr/include/gmock";
@@ -35,29 +35,29 @@ function getGMockDir(str) {
return "";
}
function getGTestAll(str) {
var gtest = getGTestDir(str);
function getGTestAll(qbs, str) {
var gtest = getGTestDir(qbs, str);
if (!gtest)
return [];
return [FileInfo.joinPaths(gtest, "src/gtest-all.cc")];
}
function getGMockAll(str) {
var gmock = getGMockDir(str);
function getGMockAll(qbs, str) {
var gmock = getGMockDir(qbs, str);
if (!gmock)
return [];
return [FileInfo.joinPaths(gmock, "src/gmock-all.cc")];
}
function getGTestIncludes(str) {
var gtest = getGTestDir(str);
function getGTestIncludes(qbs, str) {
var gtest = getGTestDir(qbs, str);
if (!gtest)
return [];
return [gtest, FileInfo.joinPaths(gtest, "include")];
}
function getGMockIncludes(str) {
var mock = getGMockDir(str);
function getGMockIncludes(qbs, str) {
var mock = getGMockDir(qbs, str);
if (!mock)
return [];
return [mock, FileInfo.joinPaths(mock, "include")];

View File

@@ -43,14 +43,14 @@ CppApplication {
}
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(googletestDir))
.concat(googleCommon.getGMockIncludes(googletestDir))
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(qbs, googletestDir))
.concat(googleCommon.getGMockIncludes(qbs, googletestDir))
files: [
"%{MainCppName}",
"%{TestCaseFileWithHeaderSuffix}",
].concat(googleCommon.getGTestAll(googletestDir))
.concat(googleCommon.getGMockAll(googletestDir))
].concat(googleCommon.getGTestAll(qbs, googletestDir))
.concat(googleCommon.getGMockAll(qbs, googletestDir))
@endif
@if "%{TestFrameWork}" == "QtQuickTest"
Depends { name: "cpp" }

File diff suppressed because it is too large Load Diff

View File

@@ -575,7 +575,6 @@ public:
"PropertyAnimation",
"SequentialAnimation",
"ParallelAnimation",
"NumberAnimation",
"Drawer"})
{
append(UnsupportedTypesByVisualDesigner());

View File

@@ -196,12 +196,13 @@ void TestTreeItem::markForRemovalRecursively(bool mark)
void TestTreeItem::markForRemovalRecursively(const QString &filePath)
{
if (m_filePath == filePath)
markForRemoval(true);
bool mark = m_filePath == filePath;
for (int row = 0, count = childCount(); row < count; ++row) {
TestTreeItem *child = childItem(row);
child->markForRemovalRecursively(filePath);
mark &= child->markedForRemoval();
}
markForRemoval(mark);
}
TestTreeItem *TestTreeItem::parentItem() const

View File

@@ -550,17 +550,16 @@ QRect BinEditorWidget::cursorRect() const
int BinEditorWidget::posAt(const QPoint &pos) const
{
int xoffset = horizontalScrollBar()->value();
const int xoffset = horizontalScrollBar()->value();
int x = xoffset + pos.x() - m_margin - m_labelWidth;
int column = qMin(15, qMax(0,x) / m_columnWidth);
qint64 topLine = verticalScrollBar()->value();
qint64 line = pos.y() / m_lineHeight;
const qint64 topLine = verticalScrollBar()->value();
const qint64 line = topLine + pos.y() / m_lineHeight;
if (x > m_bytesPerLine * m_columnWidth + m_charWidth/2) {
x -= m_bytesPerLine * m_columnWidth + m_charWidth;
for (column = 0; column < 15; ++column) {
int dataPos = (topLine + line) * m_bytesPerLine + column;
const int dataPos = line * m_bytesPerLine + column;
if (dataPos < 0 || dataPos >= m_size)
break;
QChar qc(QLatin1Char(dataAt(dataPos)));
@@ -572,7 +571,7 @@ int BinEditorWidget::posAt(const QPoint &pos) const
}
}
return qMin(m_size, qMin(m_numLines, topLine + line) * m_bytesPerLine) + column;
return qMin(m_size - 1, line * m_bytesPerLine + column);
}
bool BinEditorWidget::inTextArea(const QPoint &pos) const
@@ -1147,16 +1146,31 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const
{
int selStart = selectionStart();
int selEnd = selectionEnd();
int byteCount = selEnd - selStart + 1;
if (m_hexCursor == 0 || byteCount > 8)
return QString();
int byteCount = std::min(8, selEnd - selStart + 1);
const QPoint &startPoint = offsetToPos(selStart);
const QPoint &endPoint = offsetToPos(selEnd + 1);
QRect selRect(startPoint, endPoint);
selRect.setHeight(m_lineHeight);
if (!selRect.contains(helpEvent->pos()))
return QString();
// check even position against selection line by line
bool insideSelection = false;
int startInLine = selStart;
do {
const int lineIndex = startInLine / m_bytesPerLine;
const int endOfLine = (lineIndex + 1) * m_bytesPerLine - 1;
const int endInLine = std::min(selEnd, endOfLine);
const QPoint &startPoint = offsetToPos(startInLine);
const QPoint &endPoint = offsetToPos(endInLine) + QPoint(m_columnWidth, 0);
QRect selectionLineRect(startPoint, endPoint);
selectionLineRect.setHeight(m_lineHeight);
if (selectionLineRect.contains(helpEvent->pos())) {
insideSelection = true;
break;
}
startInLine = endInLine + 1;
} while (startInLine <= selEnd);
if (!insideSelection) {
// show popup for byte under cursor
selStart = posAt(helpEvent->pos());
selEnd = selStart;
byteCount = 1;
}
quint64 bigEndianValue, littleEndianValue;
quint64 bigEndianValueOld, littleEndianValueOld;

View File

@@ -105,7 +105,7 @@ NavigationWidget::NavigationWidget(QWidget *parent) :
verticalLayout->addWidget(Core::ItemViewFind::createSearchableWrapper(
treeView, Core::ItemViewFind::DarkColored,
Core::ItemViewFind::FetchMoreWhileSearching));
setFocusProxy(treeView);
// tree model
treeModel = new TreeItemModel(this);
treeView->setModel(treeModel);
@@ -282,10 +282,12 @@ void NavigationWidget::onDataUpdate(QSharedPointer<QStandardItem> result)
// expand top level projects
QModelIndex sessionIndex;
for (int i = 0; i < treeModel->rowCount(sessionIndex); ++i)
const int toplevelCount = treeModel->rowCount(sessionIndex);
for (int i = 0; i < toplevelCount; ++i)
treeView->expand(treeModel->index(i, 0, sessionIndex));
if (!treeView->currentIndex().isValid() && toplevelCount > 0)
treeView->setCurrentIndex(treeModel->index(0, 0, sessionIndex));
if (debug)
qDebug() << "Class View:" << QDateTime::currentDateTime().toString()
<< "TreeView is updated in" << timer.elapsed() << "msecs";

View File

@@ -239,7 +239,8 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
QList<RunConfigurationCreationInfo>
CMakeRunConfigurationFactory::availableCreators(Target *parent) const
{
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
QTC_ASSERT(project, return {});
const QStringList titles = project->buildTargetTitles(true);
return Utils::transform(titles, [this](const QString &title) { return convert(title, title); });
}

View File

@@ -53,6 +53,7 @@ const char LAST_PLATFORM_KEY[] = "Core/NewDialog/LastPlatform";
const char ALLOW_ALL_TEMPLATES[] = "Core/NewDialog/AllowAllTemplates";
const char SHOW_PLATOFORM_FILTER[] = "Core/NewDialog/ShowPlatformFilter";
const char BLACKLISTED_CATEGORIES_KEY[] = "Core/NewDialog/BlacklistedCategories";
const char ALTERNATIVE_WIZARD_STYLE[] = "Core/NewDialog/AlternativeWizardStyle";
using namespace Core;
using namespace Core::Internal;
@@ -205,6 +206,21 @@ NewDialog::NewDialog(QWidget *parent) :
m_ui->templatesView->setModel(m_filterProxyModel);
m_ui->templatesView->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
const bool alternativeWizardStyle = ICore::settings()->value(ALTERNATIVE_WIZARD_STYLE, false).toBool();
if (alternativeWizardStyle) {
m_ui->templatesView->setGridSize(QSize(256, 128));
m_ui->templatesView->setIconSize(QSize(96, 96));
m_ui->templatesView->setSpacing(4);
m_ui->templatesView->setViewMode(QListView::IconMode);
m_ui->templatesView->setMovement(QListView::Static);
m_ui->templatesView->setResizeMode(QListView::Adjust);
m_ui->templatesView->setSelectionRectVisible(false);
m_ui->templatesView->setWrapping(true);
m_ui->templatesView->setWordWrap(true);
}
connect(m_ui->templateCategoryView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &NewDialog::currentCategoryChanged);

View File

@@ -270,7 +270,8 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
for (int i = 0; i < history.size(); ++i) {
const EditLocation &item = history.at(i);
if (item.document == document
|| !DocumentModel::indexOfFilePath(FileName::fromString(item.fileName))) {
|| (!item.document
&& !DocumentModel::indexOfFilePath(FileName::fromString(item.fileName)))) {
history.removeAt(i--);
}
}

View File

@@ -154,7 +154,7 @@ void CppTypeHierarchyWidget::perform()
if (evaluator.identifiedCppElement()) {
const QSharedPointer<CppElement> &cppElement = evaluator.cppElement();
CppElement *element = cppElement.data();
if (CppClass *cppClass = dynamic_cast<CppClass *>(element)) {
if (CppClass *cppClass = element->toCppClass()) {
m_inspectedClass->setText(cppClass->name);
m_inspectedClass->setLink(cppClass->link);
QStandardItem *bases = new QStandardItem(tr("Bases"));

View File

@@ -63,6 +63,11 @@ CppElement::CppElement() : helpCategory(TextEditor::HelpItem::Unknown)
CppElement::~CppElement()
{}
CppClass *CppElement::toCppClass()
{
return nullptr;
}
class Unknown : public CppElement
{
public:
@@ -156,6 +161,11 @@ bool CppClass::operator==(const CppClass &other)
return this->declaration == other.declaration;
}
CppClass *CppClass::toCppClass()
{
return this;
}
void CppClass::lookupBases(Symbol *declaration, const LookupContext &context)
{
typedef QPair<ClassOrNamespace *, CppClass *> Data;

View File

@@ -81,6 +81,8 @@ private:
QString m_diagnosis;
};
class CppClass;
class CPPTOOLS_EXPORT CppElement
{
protected:
@@ -89,6 +91,8 @@ protected:
public:
virtual ~CppElement();
virtual CppClass *toCppClass();
TextEditor::HelpItem::Category helpCategory;
QStringList helpIdCandidates;
QString helpMark;
@@ -96,7 +100,7 @@ public:
QString tooltip;
};
class CppDeclarableElement : public CppElement
class CPPTOOLS_EXPORT CppDeclarableElement : public CppElement
{
public:
explicit CppDeclarableElement(CPlusPlus::Symbol *declaration);
@@ -109,7 +113,7 @@ public:
QIcon icon;
};
class CppClass : public CppDeclarableElement
class CPPTOOLS_EXPORT CppClass : public CppDeclarableElement
{
public:
CppClass();
@@ -117,6 +121,8 @@ public:
bool operator==(const CppClass &other);
CppClass *toCppClass() final;
void lookupBases(CPlusPlus::Symbol *declaration, const CPlusPlus::LookupContext &context);
void lookupDerived(CPlusPlus::Symbol *declaration, const CPlusPlus::Snapshot &snapshot);

View File

@@ -30,82 +30,82 @@
<widget class="QListWidget" name="checksList">
<item>
<property name="text">
<string>android-*</string>
<string notr="true">android-*</string>
</property>
</item>
<item>
<property name="text">
<string>boost-*</string>
<string notr="true">boost-*</string>
</property>
</item>
<item>
<property name="text">
<string>bugprone-*</string>
<string notr="true">bugprone-*</string>
</property>
</item>
<item>
<property name="text">
<string>cert-*</string>
<string notr="true">cert-*</string>
</property>
</item>
<item>
<property name="text">
<string>cppcoreguidelines-*</string>
<string notr="true">cppcoreguidelines-*</string>
</property>
</item>
<item>
<property name="text">
<string>clang-analyzer-*</string>
<string notr="true">clang-analyzer-*</string>
</property>
</item>
<item>
<property name="text">
<string>clang-diagnostic-*</string>
<string notr="true">clang-diagnostic-*</string>
</property>
</item>
<item>
<property name="text">
<string>google-*</string>
<string notr="true">google-*</string>
</property>
</item>
<item>
<property name="text">
<string>hicpp-*</string>
<string notr="true">hicpp-*</string>
</property>
</item>
<item>
<property name="text">
<string>llvm-*</string>
<string notr="true">llvm-*</string>
</property>
</item>
<item>
<property name="text">
<string>misc-*</string>
<string notr="true">misc-*</string>
</property>
</item>
<item>
<property name="text">
<string>modernize-*</string>
<string notr="true">modernize-*</string>
</property>
</item>
<item>
<property name="text">
<string>mpi-*</string>
<string notr="true">mpi-*</string>
</property>
</item>
<item>
<property name="text">
<string>objc-*</string>
<string notr="true">objc-*</string>
</property>
</item>
<item>
<property name="text">
<string>performance-*</string>
<string notr="true">performance-*</string>
</property>
</item>
<item>
<property name="text">
<string>readability-*</string>
<string notr="true">readability-*</string>
</property>
</item>
</widget>

View File

@@ -124,5 +124,7 @@ QAction *addCheckableAction(QMenu *menu, const QString &display, bool on, bool c
// Qt's various build paths for unpatched versions
QStringList qtBuildPaths();
void addDebugInfoTask(unsigned id, const QString &cmd);
} // namespace Internal
} // namespace Debugger

View File

@@ -94,6 +94,7 @@
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
#include <projectexplorer/devicesupport/deviceprocesslist.h>
#include <projectexplorer/itaskhandler.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorericons.h>
@@ -569,6 +570,42 @@ static Kit *findUniversalCdbKit()
return KitManager::kit(cdbPredicate());
}
///////////////////////////////////////////////////////////////////////
//
// Debuginfo Taskhandler
//
///////////////////////////////////////////////////////////////////////
class DebugInfoTaskHandler : public ITaskHandler
{
public:
bool canHandle(const Task &task) const final
{
return m_debugInfoTasks.contains(task.taskId);
}
void handle(const Task &task) final
{
QString cmd = m_debugInfoTasks.value(task.taskId);
QProcess::startDetached(cmd);
}
void addTask(unsigned id, const QString &cmd)
{
m_debugInfoTasks[id] = cmd;
}
QAction *createAction(QObject *parent) const final
{
QAction *action = new QAction(DebuggerPlugin::tr("Install &Debug Information"), parent);
action->setToolTip(DebuggerPlugin::tr("Tries to install missing debug information."));
return action;
}
private:
QHash<unsigned, QString> m_debugInfoTasks;
};
///////////////////////////////////////////////////////////////////////
//
// DebuggerPluginPrivate
@@ -1022,6 +1059,8 @@ public:
DebuggerItemManager m_debuggerItemManager;
QList<IOptionsPage *> m_optionPages;
IContext m_debugModeContext;
DebugInfoTaskHandler m_debugInfoTaskHandler;
};
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
@@ -2947,6 +2986,11 @@ QMessageBox *showMessageBox(int icon, const QString &title,
return mb;
}
void addDebugInfoTask(unsigned id, const QString &cmd)
{
dd->m_debugInfoTaskHandler.addTask(id, cmd);
}
bool isReverseDebuggingEnabled()
{
static bool enabled = qEnvironmentVariableIsSet("QTC_DEBUGGER_ENABLE_REVERSE");

View File

@@ -55,7 +55,6 @@
#include <coreplugin/messagebox.h>
#include <projectexplorer/devicesupport/deviceprocess.h>
#include <projectexplorer/itaskhandler.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/taskhub.h>
@@ -131,52 +130,6 @@ static bool isMostlyHarmlessMessage(const QStringRef &msg)
"Invalid argument\\n";
}
///////////////////////////////////////////////////////////////////////
//
// Debuginfo Taskhandler
//
///////////////////////////////////////////////////////////////////////
class DebugInfoTask
{
public:
QString command;
};
class DebugInfoTaskHandler : public ITaskHandler
{
public:
explicit DebugInfoTaskHandler(GdbEngine *engine)
: m_engine(engine)
{}
bool canHandle(const Task &task) const override
{
return m_debugInfoTasks.contains(task.taskId);
}
void handle(const Task &task) override
{
m_engine->requestDebugInformation(m_debugInfoTasks.value(task.taskId));
}
void addTask(unsigned id, const DebugInfoTask &task)
{
m_debugInfoTasks[id] = task;
}
QAction *createAction(QObject *parent) const override
{
QAction *action = new QAction(DebuggerPlugin::tr("Install &Debug Information"), parent);
action->setToolTip(DebuggerPlugin::tr("Tries to install missing debug information."));
return action;
}
private:
GdbEngine *m_engine;
QHash<unsigned, DebugInfoTask> m_debugInfoTasks;
};
///////////////////////////////////////////////////////////////////////
//
// GdbEngine
@@ -190,9 +143,6 @@ GdbEngine::GdbEngine()
m_gdbOutputCodec = QTextCodec::codecForLocale();
m_inferiorOutputCodec = QTextCodec::codecForLocale();
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
//ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler);
m_commandTimer.setSingleShot(true);
connect(&m_commandTimer, &QTimer::timeout,
this, &GdbEngine::commandTimeout);
@@ -222,10 +172,6 @@ GdbEngine::GdbEngine()
GdbEngine::~GdbEngine()
{
//ExtensionSystem::PluginManager::removeObject(m_debugInfoTaskHandler);
delete m_debugInfoTaskHandler;
m_debugInfoTaskHandler = 0;
// Prevent sending error messages afterwards.
disconnect();
}
@@ -434,10 +380,7 @@ void GdbEngine::handleResponse(const QString &buff)
FileName(), 0, Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::addTask(task);
DebugInfoTask dit;
dit.command = cmd;
m_debugInfoTaskHandler->addTask(task.taskId, dit);
Internal::addDebugInfoTask(task.taskId, cmd);
}
}
@@ -4184,11 +4127,6 @@ void GdbEngine::scheduleTestResponse(int testCase, const QString &response)
m_scheduledTestResponses[token] = response;
}
void GdbEngine::requestDebugInformation(const DebugInfoTask &task)
{
QProcess::startDetached(task.command);
}
QString GdbEngine::msgGdbStopFailed(const QString &why)
{
return tr("The gdb process could not be stopped:\n%1").arg(why);

View File

@@ -382,11 +382,6 @@ private: ////////// General Interface //////////
QHash<int, QString> m_scheduledTestResponses;
QSet<int> m_testCases;
// Debug information
friend class DebugInfoTaskHandler;
void requestDebugInformation(const DebugInfoTask &task);
DebugInfoTaskHandler *m_debugInfoTaskHandler;
bool m_systemDumpersLoaded = false;
static QString msgGdbStopFailed(const QString &why);

View File

@@ -251,7 +251,7 @@ void ChangeSelectionDialog::recalculateDetails()
connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
this, &ChangeSelectionDialog::setDetails);
m_process->start(m_gitExecutable.toString(), {"show", "--stat=80", ref});
m_process->start(m_gitExecutable.toString(), {"show", "--decorate", "--stat=80", ref});
m_process->closeWriteChannel();
if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));

View File

@@ -432,7 +432,7 @@ void TextBrowserHelpWidget::mouseReleaseEvent(QMouseEvent *e)
bool controlPressed = e->modifiers() & Qt::ControlModifier;
const QString link = linkAt(e->pos());
if ((controlPressed || e->button() == Qt::MidButton) && link.isEmpty()) {
if ((controlPressed || e->button() == Qt::MidButton) && !link.isEmpty()) {
emit m_parent->newPageRequested(QUrl(link));
return;
}

View File

@@ -53,7 +53,8 @@ IosRunConfigurationFactory::IosRunConfigurationFactory()
QList<RunConfigurationCreationInfo>
IosRunConfigurationFactory::availableCreators(Target *parent) const
{
auto project = static_cast<QmakeProject *>(parent->project());
auto project = qobject_cast<QmakeProject *>(parent->project());
QTC_ASSERT(project, return {});
return project->runConfigurationCreators(this, {ProjectType::ApplicationTemplate,
ProjectType::SharedLibraryTemplate});
}

View File

@@ -1185,7 +1185,7 @@ void GccToolChainConfigWidget::handleCompilerCommandChange()
{
bool haveCompiler = false;
Abi currentAbi = m_abiWidget->currentAbi();
bool customAbi = m_abiWidget->isCustomAbi();
bool customAbi = m_abiWidget->isCustomAbi() && m_abiWidget->isEnabled();
FileName path = m_compilerCommand->fileName();
QList<Abi> abiList;

View File

@@ -55,6 +55,7 @@
#include <QToolButton>
#include <QPainter>
#include <QAction>
#include <QLineEdit>
#include <QMenu>
#include <memory>
@@ -415,8 +416,23 @@ void ProjectTreeWidget::collapseAll()
void ProjectTreeWidget::editCurrentItem()
{
m_delayedRename.clear();
if (m_view->selectionModel()->currentIndex().isValid())
m_view->edit(m_view->selectionModel()->currentIndex());
const QModelIndex currentIndex = m_view->selectionModel()->currentIndex();
if (!currentIndex.isValid())
return;
m_view->edit(currentIndex);
// Select complete file basename for renaming
const Node *node = m_model->nodeForIndex(currentIndex);
if (!node || node->nodeType() != NodeType::File)
return;
QLineEdit *editor = qobject_cast<QLineEdit*>(m_view->indexWidget(currentIndex));
if (!editor)
return;
const QString text = editor->text();
const int dotIndex = text.lastIndexOf(QLatin1Char('.'));
if (dotIndex > 0)
editor->setSelection(0, dotIndex);
}
void ProjectTreeWidget::renamed(const FileName &oldPath, const FileName &newPath)

View File

@@ -210,11 +210,18 @@ void TaskView::resizeEvent(QResizeEvent *e)
class TaskWindowPrivate
{
public:
ITaskHandler *handler(const QAction *action)
{
ITaskHandler *handler = m_actionToHandlerMap.value(action, nullptr);
return g_taskHandlers.contains(handler) ? handler : nullptr;
}
Internal::TaskModel *m_model;
Internal::TaskFilterModel *m_filter;
Internal::TaskView *m_listview;
Internal::TaskWindowContext *m_taskWindowContext;
QMenu *m_contextMenu;
QMap<const QAction *, ITaskHandler *> m_actionToHandlerMap;
ITaskHandler *m_defaultHandler = nullptr;
QToolButton *m_filterWarningsButton;
QToolButton *m_categoriesButton;
@@ -318,14 +325,6 @@ TaskWindow::~TaskWindow()
delete d;
}
static ITaskHandler *handler(QAction *action)
{
QVariant prop = action->property("ITaskHandler");
ITaskHandler *handler = qobject_cast<ITaskHandler *>(prop.value<QObject *>());
QTC_CHECK(handler);
return handler;
}
void TaskWindow::delayedInitialization()
{
static bool alreadyDone = false;
@@ -340,7 +339,7 @@ void TaskWindow::delayedInitialization()
QAction *action = h->createAction(this);
QTC_ASSERT(action, continue);
action->setProperty("ITaskHandler", qVariantFromValue(qobject_cast<QObject*>(h)));
d->m_actionToHandlerMap.insert(action, h);
connect(action, &QAction::triggered, this, &TaskWindow::actionTriggered);
d->m_actions << action;
@@ -395,7 +394,7 @@ void TaskWindow::currentChanged(const QModelIndex &index)
{
const Task task = index.isValid() ? d->m_filter->task(index) : Task();
foreach (QAction *action, d->m_actions) {
ITaskHandler *h = handler(action);
ITaskHandler *h = d->handler(action);
action->setEnabled((task.isNull() || !h) ? false : h->canHandle(task));
}
}
@@ -511,7 +510,7 @@ void TaskWindow::actionTriggered()
auto action = qobject_cast<QAction *>(sender());
if (!action || !action->isEnabled())
return;
ITaskHandler *h = handler(action);
ITaskHandler *h = d->handler(action);
if (!h)
return;

View File

@@ -372,7 +372,7 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep)
const QString profileName = QbsManager::profileForKit(buildStep->target()->kit());
const QString buildVariant = qbsConfiguration()
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
Utils::QtcProcess::addArg(&commandLine, configurationName());
Utils::QtcProcess::addArg(&commandLine, QLatin1String("config:") + configurationName());
Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)
+ QLatin1Char(':') + buildVariant);
const Utils::FileName installRoot = stepProxy.installRoot();

View File

@@ -634,7 +634,7 @@ void QbsBuildStepConfigWidget::updateState()
}
if (m_step->isQmlDebuggingEnabled())
command.append(Constants::QBS_CONFIG_QUICK_DEBUG_KEY).append(":true");
command.append(' ').append(Constants::QBS_CONFIG_QUICK_DEBUG_KEY).append(":true");
m_ui->commandLineTextEdit->setPlainText(command);
QString summary = tr("<b>Qbs:</b> %1").arg(command);

View File

@@ -57,7 +57,8 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory()
QList<RunConfigurationCreationInfo> QmakeAndroidRunConfigurationFactory::availableCreators(Target *parent) const
{
auto project = static_cast<QmakeProject *>(parent->project());
auto project = qobject_cast<QmakeProject *>(parent->project());
QTC_ASSERT(project, return {});
return project->runConfigurationCreators(this, {ProjectType::ApplicationTemplate, ProjectType::SharedLibraryTemplate});
}

View File

@@ -437,14 +437,16 @@ DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory()
bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
{
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QmakeProject *project = qobject_cast<QmakeProject *>(parent->project());
QTC_ASSERT(project, return {});
return project->hasApplicationProFile(Utils::FileName::fromString(buildTarget));
}
QList<RunConfigurationCreationInfo>
DesktopQmakeRunConfigurationFactory::availableCreators(Target *parent) const
{
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QmakeProject *project = qobject_cast<QmakeProject *>(parent->project());
QTC_ASSERT(project, return {});
return project->runConfigurationCreators(this);
}

View File

@@ -614,6 +614,9 @@ bool raiseAvailable(const SelectionContext &selectionState)
if (modelNode.isRootNode())
return false;
if (!modelNode.hasParentProperty())
return false;
if (!modelNode.parentProperty().isNodeListProperty())
return false;

View File

@@ -874,7 +874,7 @@ PropertyName getIndexPropertyName(const ModelNode &modelNode)
return PropertyName();
}
void static setIndexProperty(const AbstractProperty &property, const QVariant &value)
static void setIndexProperty(const AbstractProperty &property, const QVariant &value)
{
if (!property.exists() || property.isVariantProperty()) {
/* Using QmlObjectNode ensures we take states into account. */

View File

@@ -88,7 +88,8 @@ void ContentNotEditableIndicator::updateItems(const QList<FormEditorItem *> &ite
void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem *> &itemList)
{
foreach (FormEditorItem *formEditorItem, itemList) {
if (formEditorItem->qmlItemNode().modelNode().metaInfo().isSubclassOf("QtQuick.Loader")) {
const ModelNode modelNode = formEditorItem->qmlItemNode().modelNode();
if (modelNode.metaInfo().isValid() && modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) {
if (!m_entryList.contains(EntryPair(formEditorItem, 0))) {
QGraphicsRectItem *indicatorShape = new QGraphicsRectItem(m_layerItem);

View File

@@ -130,8 +130,9 @@ QString DesignDocumentView::toText() const
ModelNode rewriterNode(rewriterView->rootModelNode());
rewriterView->writeAuxiliaryData();
return rewriterView->extractText({rewriterNode}).value(rewriterNode) + rewriterView->getRawAuxiliaryData();
//get the text of the root item without imports
return rewriterView->extractText({rewriterNode}).value(rewriterNode);
}
void DesignDocumentView::fromText(QString text)
@@ -151,6 +152,8 @@ void DesignDocumentView::fromText(QString text)
rewriterView->setTextModifier(&modifier);
inputModel->setRewriterView(rewriterView.data());
rewriterView->restoreAuxiliaryData();
if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) {
ModelMerger merger(this);
merger.replaceModel(rewriterView->rootModelNode());

View File

@@ -64,6 +64,7 @@ public:
bool isStackedContainer() const;
bool canBeReparentedTo(const ModelNode &potenialParent);
QString indexPropertyForStackedContainer() const;
bool takesOverRenderingOfChildren() const;
QHash<QString, QString> hints() const;
static NodeHints fromModelNode(const ModelNode &modelNode);

View File

@@ -163,6 +163,12 @@ public:
void qmlTextChanged();
void delayedSetup();
void writeAuxiliaryData();
void restoreAuxiliaryData();
QString getRawAuxiliaryData() const;
QString auxiliaryDataAsQML() const;
protected: // functions
void importAdded(const Import &import);
void importRemoved(const Import &import);

View File

@@ -34,6 +34,7 @@
#include <model.h>
#include <modelnode.h>
#include <metainfo.h>
#include <nodehints.h>
#include <rewriterview.h>
#include "abstractproperty.h"
@@ -125,7 +126,7 @@ NodeInstanceView::~NodeInstanceView()
//\{
bool isSkippedRootNode(const ModelNode &node)
bool static isSkippedRootNode(const ModelNode &node)
{
static const PropertyNameList skipList({"Qt.ListModel", "QtQuick.ListModel", "Qt.ListModel", "QtQuick.ListModel"});
@@ -136,7 +137,7 @@ bool isSkippedRootNode(const ModelNode &node)
}
bool isSkippedNode(const ModelNode &node)
bool static isSkippedNode(const ModelNode &node)
{
static const PropertyNameList skipList({"QtQuick.XmlRole", "Qt.XmlRole", "QtQuick.ListElement", "Qt.ListElement"});
@@ -146,6 +147,22 @@ bool isSkippedNode(const ModelNode &node)
return false;
}
bool static parentTakesOverRendering(const ModelNode &modelNode)
{
if (!modelNode.isValid())
return false;
ModelNode currentNode = modelNode;
while (currentNode.hasParentProperty()) {
currentNode = currentNode.parentProperty().parentModelNode();
if (NodeHints::fromModelNode(currentNode).takesOverRenderingOfChildren())
return true;
}
return false;
}
/*!
Notifies the view that it was attached to \a model. For every model node in
the model, a NodeInstance will be created.
@@ -817,6 +834,11 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
if (instance.modelNode().metaInfo().isSubclassOf("QtQuick.Item"))
nodeMetaType = InstanceContainer::ItemMetaType;
InstanceContainer::NodeFlags nodeFlags;
if (parentTakesOverRendering(instance.modelNode()))
nodeFlags |= InstanceContainer::ParentTakesOverRendering;
InstanceContainer container(instance.instanceId(),
instance.modelNode().type(),
instance.modelNode().majorVersion(),
@@ -824,8 +846,8 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
instance.modelNode().metaInfo().componentFileName(),
instance.modelNode().nodeSource(),
nodeSourceType,
nodeMetaType
);
nodeMetaType,
nodeFlags);
instanceContainerList.append(container);
}
@@ -958,8 +980,20 @@ CreateInstancesCommand NodeInstanceView::createCreateInstancesCommand(const QLis
if (instance.modelNode().metaInfo().isSubclassOf("QtQuick.Item"))
nodeMetaType = InstanceContainer::ItemMetaType;
InstanceContainer container(instance.instanceId(), instance.modelNode().type(), instance.modelNode().majorVersion(), instance.modelNode().minorVersion(),
instance.modelNode().metaInfo().componentFileName(), instance.modelNode().nodeSource(), nodeSourceType, nodeMetaType);
InstanceContainer::NodeFlags nodeFlags;
if (parentTakesOverRendering(instance.modelNode()))
nodeFlags |= InstanceContainer::ParentTakesOverRendering;
InstanceContainer container(instance.instanceId(),
instance.modelNode().type(),
instance.modelNode().majorVersion(),
instance.modelNode().minorVersion(),
instance.modelNode().metaInfo().componentFileName(),
instance.modelNode().nodeSource(),
nodeSourceType,
nodeMetaType,
nodeFlags);
containerList.append(container);
}

View File

@@ -350,6 +350,7 @@ QStringList ItemLibraryInfo::showTagsForImports() const
auto list = m_showTagsForImports;
if (m_baseInfo)
list.append(m_baseInfo->m_showTagsForImports);
list.removeDuplicates();
return list;
}

View File

@@ -193,6 +193,14 @@ QString NodeHints::indexPropertyForStackedContainer() const
return Internal::evaluateExpression(expression, modelNode(), ModelNode()).toString();
}
bool NodeHints::takesOverRenderingOfChildren() const
{
if (!isValid())
return false;
return evaluateBooleanExpression("takesOverRenderingOfChildren", false);
}
QHash<QString, QString> NodeHints::hints() const
{
return m_hints;

View File

@@ -60,6 +60,13 @@ static void syncVariantProperties(ModelNode &outputNode, const ModelNode &inputN
}
}
static void syncAuxiliaryProperties(ModelNode &outputNode, const ModelNode &inputNode)
{
auto tmp = inputNode.auxiliaryData();
for (auto iter = tmp.begin(); iter != tmp.end(); ++iter)
outputNode.setAuxiliaryData(iter.key(), iter.value());
}
static void syncBindingProperties(ModelNode &outputNode, const ModelNode &inputNode, const QHash<QString, QString> &idRenamingHash)
{
foreach (const BindingProperty &bindingProperty, inputNode.bindingProperties()) {
@@ -138,6 +145,7 @@ static ModelNode createNodeFromNode(const ModelNode &modelNode,const QHash<QStri
NodeMetaInfo nodeMetaInfo = view->model()->metaInfo(modelNode.type());
ModelNode newNode(view->createModelNode(modelNode.type(), nodeMetaInfo.majorVersion(), nodeMetaInfo.minorVersion(),
propertyList, variantPropertyList, modelNode.nodeSource(), modelNode.nodeSourceType()));
syncAuxiliaryProperties(newNode, modelNode);
syncBindingProperties(newNode, modelNode, idRenamingHash);
syncId(newNode, modelNode, idRenamingHash);
syncNodeProperties(newNode, modelNode, idRenamingHash, view);
@@ -165,7 +173,6 @@ ModelNode ModelMerger::insertModel(const ModelNode &modelNode)
return newNode;
}
void ModelMerger::replaceModel(const ModelNode &modelNode)
{
view()->model()->changeImports(modelNode.model()->imports(), {});
@@ -182,6 +189,7 @@ void ModelMerger::replaceModel(const ModelNode &modelNode)
QHash<QString, QString> idRenamingHash;
setupIdRenamingHash(modelNode, idRenamingHash, view());
syncAuxiliaryProperties(rootNode, modelNode);
syncVariantProperties(rootNode, modelNode);
syncBindingProperties(rootNode, modelNode, idRenamingHash);
syncId(rootNode, modelNode, idRenamingHash);

View File

@@ -42,11 +42,17 @@
#include <qmljs/parser/qmljsengine_p.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljssimplereader.h>
#include <utils/changeset.h>
#include <utils/qtcassert.h>
using namespace QmlDesigner::Internal;
namespace QmlDesigner {
const char annotationsEscapeSequence[] = "##^##";
RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *parent):
AbstractView(parent),
m_differenceHandling(differenceHandling),
@@ -442,6 +448,56 @@ void RewriterView::notifyErrorsAndWarnings(const QList<DocumentMessage> &errors)
emitDocumentMessage(errors, m_warnings);
}
QString RewriterView::auxiliaryDataAsQML() const
{
bool hasAuxData = false;
QString str = "Designer {\n ";
int columnCount = 0;
for (const auto node : allModelNodes()) {
QHash<PropertyName, QVariant> data = node.auxiliaryData();
if (!data.isEmpty()) {
hasAuxData = true;
if (columnCount > 80) {
str += "\n";
columnCount = 0;
}
const int startLen = str.length();
str += "D{";
str += "i:";
str += QString::number(node.internalId());
str += ";";
for (auto i = data.begin(); i != data.end(); ++i) {
const QVariant value = i.value();
QString strValue = value.toString();
if (static_cast<QMetaType::Type>(value.type()) == QMetaType::QString)
strValue = "\"" + strValue + "\"";
if (!strValue.isEmpty()) {
str += QString::fromUtf8(i.key()) + ":";
str += strValue;
str += ";";
}
}
if (str.endsWith(';'))
str.chop(1);
str += "}";
columnCount += str.length() - startLen;
}
}
str += "\n}\n";
if (hasAuxData)
return str;
return {};
}
Internal::ModelNodePositionStorage *RewriterView::positionStorage() const
{
return m_positionStorage.data();
@@ -820,4 +876,108 @@ void RewriterView::delayedSetup()
m_textToModelMerger->delayedSetup();
}
static QString annotationsEnd()
{
const static QString end = QString(" %1*/\n").arg(annotationsEscapeSequence);
return end;
}
static QString annotationsStart()
{
const static QString start = QString("\n/*%1 ").arg(annotationsEscapeSequence);
return start;
}
QString RewriterView::getRawAuxiliaryData() const
{
QTC_ASSERT(m_textModifier, return {});
const QString oldText = m_textModifier->text();
QString newText = oldText;
int startIndex = newText.indexOf(annotationsStart());
int endIndex = newText.indexOf(annotationsEnd());
if (startIndex > 0 && endIndex > 0)
return newText.mid(startIndex, endIndex - startIndex + annotationsEnd().length());
return {};
}
void RewriterView::writeAuxiliaryData()
{
QTC_ASSERT(m_textModifier, return);
const QString oldText = m_textModifier->text();
QString newText = oldText;
int startIndex = newText.indexOf(annotationsStart());
int endIndex = newText.indexOf(annotationsEnd());
if (startIndex > 0 && endIndex > 0)
newText.remove(startIndex, endIndex - startIndex + annotationsEnd().length());
QString auxData = auxiliaryDataAsQML();
if (!auxData.isEmpty()) {
auxData.prepend(annotationsStart());
auxData.append(annotationsEnd());
newText.append(auxData);
QTextCursor tc(m_textModifier->textDocument());
Utils::ChangeSet changeSet;
changeSet.replace(0, oldText.length(), newText);
changeSet.apply(&tc);
}
}
static void checkNode(QmlJS::SimpleReaderNode::Ptr node, RewriterView *view);
static void checkChildNodes(QmlJS::SimpleReaderNode::Ptr node, RewriterView *view)
{
for (auto child : node->children())
checkNode(child, view);
}
static void checkNode(QmlJS::SimpleReaderNode::Ptr node, RewriterView *view)
{
if (!node)
return;
if (!node->propertyNames().contains("i"))
return;
const int internalId = node->property("i").toInt();
const ModelNode modelNode = view->modelNodeForInternalId(internalId);
if (!modelNode.isValid())
return;
auto properties = node->properties();
for (auto i = properties.begin(); i != properties.end(); ++i) {
if (i.key() != "i")
modelNode.setAuxiliaryData(i.key().toUtf8(), i.value());
}
checkChildNodes(node, view);
}
void RewriterView::restoreAuxiliaryData()
{
QTC_ASSERT(m_textModifier, return);
const QString text = m_textModifier->text();
int startIndex = text.indexOf(annotationsStart());
int endIndex = text.indexOf(annotationsEnd());
if (startIndex > 0 && endIndex > 0) {
const QString auxSource = text.mid(startIndex + annotationsStart().length(),
endIndex - startIndex - annotationsStart().length());
QmlJS::SimpleReader reader;
checkChildNodes(reader.readFromSource(auxSource), this);
}
}
} //QmlDesigner

View File

@@ -94,7 +94,7 @@ static inline QStringList globalQtEnums()
static inline QStringList knownEnumScopes()
{
static const QStringList list = {
"TextInput", "TextEdit", "Material", "Universal", "Font"
"TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath"
};
return list;
}

View File

@@ -279,18 +279,49 @@ void QmlProject::refreshTargetDirectory()
bool QmlProject::supportsKit(const Kit *k, QString *errorMessage) const
{
if (!k->isValid()) {
if (errorMessage)
*errorMessage = tr("Kit is not valid.");
return false;
}
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
if (dev.isNull()) {
if (errorMessage)
*errorMessage = tr("Kit has no device.");
return false;
}
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version) {
if (errorMessage)
*errorMessage = tr("No Qt version set in kit.");
return false;
}
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0)) {
if (errorMessage)
*errorMessage = tr("Qt version is too old.");
return false;
}
if (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
if (version->type() == QtSupport::Constants::DESKTOPQT) {
if (static_cast<QtSupport::DesktopQtVersion *>(version)->qmlsceneCommand().isEmpty()) {
if (errorMessage)
*errorMessage = tr("Qt version has no qmlscene command.");
return false;
}
} else {
// Non-desktop Qt on a desktop device? We don't support that.
if (errorMessage)
*errorMessage = tr("Non-desktop Qt is used with a Desktop device.");
return false;
}
}
// If not a desktop device, don't check the Qt version for qmlscene.
// The device is responsible for providing it and we assume qmlscene can be found
// in $PATH if it's not explicitly given.
return true;
}
@@ -305,43 +336,10 @@ Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *erro
if (!activeTarget()) {
// find a kit that matches prerequisites (prefer default one)
QList<Kit*> kits = KitManager::kits(
std::function<bool(const Kit *)>([](const Kit *k) -> bool {
if (!k->isValid())
return false;
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
if (dev.isNull())
return false;
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version || version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0))
return false;
if (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
if (version->type() != QLatin1String(QtSupport::Constants::DESKTOPQT)) {
return !static_cast<QtSupport::DesktopQtVersion *>(version)
->qmlsceneCommand().isEmpty();
} else {
// Non-desktop Qt on a desktop device? We don't support that.
return false;
}
}
// If not a desktop device, don't check the Qt version for qmlscene.
// The device is responsible for providing it and we assume qmlscene can be found
// in $PATH if it's not explicitly given.
return true;
})
);
const QList<Kit*> kits = KitManager::kits([this](const Kit *k) { return supportsKit(k, nullptr); });
if (!kits.isEmpty()) {
Kit *kit = 0;
if (kits.contains(KitManager::defaultKit()))
kit = KitManager::defaultKit();
else
kit = kits.first();
Kit *kit = kits.contains(KitManager::defaultKit()) ? KitManager::defaultKit() : kits.first();
addTarget(createTarget(kit));
}
}

View File

@@ -27,6 +27,7 @@
#include "qmlproject.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
#include <projectexplorer/kit.h>
#include <utils/qtcassert.h>
@@ -39,28 +40,35 @@ namespace QmlProjectManager {
QList<int> QmlProjectEnvironmentAspect::possibleBaseEnvironments() const
{
return QList<int>() << static_cast<int>(KitEnvironmentBase)
<< static_cast<int>(SystemEnvironmentBase);
QList<int> ret;
if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(runConfiguration()->target()->kit())
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
ret << SystemEnvironmentBase;
}
ret << CleanEnvironmentBase;
return ret;
}
QString QmlProjectEnvironmentAspect::baseEnvironmentDisplayName(int base) const
{
if (base == static_cast<int>(SystemEnvironmentBase))
switch (base) {
case SystemEnvironmentBase:
return tr("System Environment");
if (base == static_cast<int>(KitEnvironmentBase))
return tr("Kit Environment");
case CleanEnvironmentBase:
return tr("Clean Environment");
default:
QTC_CHECK(false);
return QString();
}
}
Utils::Environment QmlProjectEnvironmentAspect::baseEnvironment() const
{
int base = baseEnvironmentBase();
Utils::Environment env = Utils::Environment::systemEnvironment();
if (base == static_cast<int>(KitEnvironmentBase))
runConfiguration()->target()->kit()->addToEnvironment(env);
Utils::Environment env = baseEnvironmentBase() == SystemEnvironmentBase
? Utils::Environment::systemEnvironment()
: Utils::Environment();
QmlProject *project = qobject_cast<QmlProject *>(runConfiguration()->target()->project());
if (project)
if (QmlProject *project = qobject_cast<QmlProject *>(runConfiguration()->target()->project()))
env.modify(project->environment());
return env;

View File

@@ -43,7 +43,7 @@ public:
private:
enum BaseEnvironmentBase {
SystemEnvironmentBase = 0,
KitEnvironmentBase
CleanEnvironmentBase,
};
};

View File

@@ -29,6 +29,8 @@
#include "qnxrunconfiguration.h"
#include "qnxdevicefactory.h"
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
namespace Qnx {
namespace Internal {
@@ -36,6 +38,7 @@ QnxRunConfigurationFactory::QnxRunConfigurationFactory()
{
registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
}
} // namespace Internal

View File

@@ -282,91 +282,7 @@ void BaseQtVersion::ctor(const FileName &qmakePath)
void BaseQtVersion::setupExpander()
{
m_expander.setDisplayName(
QtKitInformation::tr("Qt version"));
m_expander.registerVariable("Qt:Version",
QtKitInformation::tr("The version string of the current Qt version."),
[this] { return qtVersionString(); });
m_expander.registerVariable("Qt:Type",
QtKitInformation::tr("The type of the current Qt version."),
[this] { return type(); });
m_expander.registerVariable("Qt:Mkspec",
QtKitInformation::tr("The mkspec of the current Qt version."),
[this] { return mkspec().toUserOutput(); });
m_expander.registerVariable("Qt:QT_INSTALL_PREFIX",
QtKitInformation::tr("The installation prefix of the current Qt version."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_PREFIX"); });
m_expander.registerVariable("Qt:QT_INSTALL_DATA",
QtKitInformation::tr("The installation location of the current Qt version's data."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_DATA"); });
m_expander.registerVariable("Qt:QT_INSTALL_HEADERS",
QtKitInformation::tr("The installation location of the current Qt version's header files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_HEADERS"); });
m_expander.registerVariable("Qt:QT_INSTALL_LIBS",
QtKitInformation::tr("The installation location of the current Qt version's library files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_LIBS"); });
m_expander.registerVariable("Qt:QT_INSTALL_DOCS",
QtKitInformation::tr("The installation location of the current Qt version's documentation files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_DOCS"); });
m_expander.registerVariable("Qt:QT_INSTALL_BINS",
QtKitInformation::tr("The installation location of the current Qt version's executable files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_BINS"); });
m_expander.registerVariable("Qt:QT_INSTALL_PLUGINS",
QtKitInformation::tr("The installation location of the current Qt version's plugins."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_PLUGINS"); });
m_expander.registerVariable("Qt:QT_INSTALL_QML",
QtKitInformation::tr("The installation location of the current Qt version's QML files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_QML"); });
m_expander.registerVariable("Qt:QT_INSTALL_IMPORTS",
QtKitInformation::tr("The installation location of the current Qt version's imports."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_IMPORTS"); });
m_expander.registerVariable("Qt:QT_INSTALL_TRANSLATIONS",
QtKitInformation::tr("The installation location of the current Qt version's translation files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_TRANSLATIONS"); });
m_expander.registerVariable("Qt:QT_INSTALL_CONFIGURATION",
QtKitInformation::tr("The installation location of the current Qt version's translation files."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_CONFIGURATION"); });
m_expander.registerVariable("Qt:QT_INSTALL_EXAMPLES",
QtKitInformation::tr("The installation location of the current Qt version's examples."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_EXAMPLES"); });
m_expander.registerVariable("Qt:QT_INSTALL_DEMOS",
QtKitInformation::tr("The installation location of the current Qt version's demos."),
[this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_DEMOS"); });
m_expander.registerVariable("Qt:QMAKE_MKSPECS",
QtKitInformation::tr("The current Qt version's default mkspecs (Qt 4)."),
[this] { return qmakeProperty(m_versionInfo, "QMAKE_MKSPECS"); });
m_expander.registerVariable("Qt:QMAKE_SPEC",
QtKitInformation::tr("The current Qt version's default mkspec (Qt 5; host system)."),
[this] { return qmakeProperty(m_versionInfo, "QMAKE_SPEC"); });
m_expander.registerVariable("Qt:QMAKE_XSPEC",
QtKitInformation::tr("The current Qt version's default mkspec (Qt 5; target system)."),
[this] { return qmakeProperty(m_versionInfo, "QMAKE_XSPEC"); });
m_expander.registerVariable("Qt:QMAKE_VERSION",
QtKitInformation::tr("The current Qt's qmake version."),
[this] { return qmakeProperty(m_versionInfo, "QMAKE_VERSION"); });
// FIXME: Re-enable once we can detect expansion loops.
// m_expander.registerVariable("Qt:Name",
// QtKitInformation::tr("The display name of the current Qt version."),
// [this] { return displayName(); });
m_expander = createMacroExpander([this]{ return this; });
}
BaseQtVersion::~BaseQtVersion()
@@ -801,7 +717,7 @@ void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
QString BaseQtVersion::displayName() const
{
return m_expander.expand(m_unexpandedDisplayName);
return m_expander->expand(m_unexpandedDisplayName);
}
QString BaseQtVersion::unexpandedDisplayName() const
@@ -1312,7 +1228,169 @@ QStringList BaseQtVersion::qtConfigValues() const
MacroExpander *BaseQtVersion::macroExpander() const
{
return &m_expander;
return m_expander.get();
}
std::unique_ptr<MacroExpander> BaseQtVersion::createMacroExpander(const std::function<BaseQtVersion *()> &qtVersion)
{
const auto versionProperty =
[qtVersion](const std::function<QString(BaseQtVersion *)> &property) {
return [property, qtVersion]() -> QString {
BaseQtVersion *version = qtVersion();
return version ? property(version) : QString();
};
};
std::unique_ptr<Utils::MacroExpander> expander(new Utils::MacroExpander);
expander->setDisplayName(QtKitInformation::tr("Qt version"));
expander->registerVariable(
"Qt:Version",
QtKitInformation::tr("The version string of the current Qt version."),
versionProperty([](BaseQtVersion *version) {
return version->qtVersionString();
}));
expander->registerVariable(
"Qt:Type",
QtKitInformation::tr("The type of the current Qt version."),
versionProperty([](BaseQtVersion *version) {
return version->type();
}));
expander->registerVariable(
"Qt:Mkspec",
QtKitInformation::tr("The mkspec of the current Qt version."),
versionProperty([](BaseQtVersion *version) {
return version->mkspec().toUserOutput();
}));
expander->registerVariable(
"Qt:QT_INSTALL_PREFIX",
QtKitInformation::tr("The installation prefix of the current Qt version."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_PREFIX");
}));
expander->registerVariable(
"Qt:QT_INSTALL_DATA",
QtKitInformation::tr("The installation location of the current Qt version's data."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_DATA");
}));
expander->registerVariable(
"Qt:QT_INSTALL_HEADERS",
QtKitInformation::tr("The installation location of the current Qt version's header files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_HEADERS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_LIBS",
QtKitInformation::tr("The installation location of the current Qt version's library files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_LIBS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_DOCS",
QtKitInformation::tr("The installation location of the current Qt version's documentation files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_DOCS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_BINS",
QtKitInformation::tr("The installation location of the current Qt version's executable files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_BINS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_PLUGINS",
QtKitInformation::tr("The installation location of the current Qt version's plugins."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_PLUGINS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_QML",
QtKitInformation::tr("The installation location of the current Qt version's QML files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_QML");
}));
expander->registerVariable(
"Qt:QT_INSTALL_IMPORTS",
QtKitInformation::tr("The installation location of the current Qt version's imports."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_IMPORTS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_TRANSLATIONS",
QtKitInformation::tr("The installation location of the current Qt version's translation files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_TRANSLATIONS");
}));
expander->registerVariable(
"Qt:QT_INSTALL_CONFIGURATION",
QtKitInformation::tr("The installation location of the current Qt version's translation files."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_CONFIGURATION");
}));
expander->registerVariable(
"Qt:QT_INSTALL_EXAMPLES",
QtKitInformation::tr("The installation location of the current Qt version's examples."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_EXAMPLES");
}));
expander->registerVariable(
"Qt:QT_INSTALL_DEMOS",
QtKitInformation::tr("The installation location of the current Qt version's demos."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QT_INSTALL_DEMOS");
}));
expander->registerVariable(
"Qt:QMAKE_MKSPECS",
QtKitInformation::tr("The current Qt version's default mkspecs (Qt 4)."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QMAKE_MKSPECS");
}));
expander->registerVariable(
"Qt:QMAKE_SPEC",
QtKitInformation::tr("The current Qt version's default mkspec (Qt 5; host system)."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QMAKE_SPEC");
}));
expander->registerVariable(
"Qt:QMAKE_XSPEC",
QtKitInformation::tr("The current Qt version's default mkspec (Qt 5; target system)."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QMAKE_XSPEC");
}));
expander->registerVariable(
"Qt:QMAKE_VERSION",
QtKitInformation::tr("The current Qt's qmake version."),
versionProperty([](BaseQtVersion *version) {
return version->qmakeProperty(version->m_versionInfo, "QMAKE_VERSION");
}));
// FIXME: Re-enable once we can detect expansion loops.
// expander->registerVariable("Qt:Name",
// QtKitInformation::tr("The display name of the current Qt version."),
// versionProperty([](BaseQtVersion *version) {
// return version->displayName();
// }));
return expander;
}
void BaseQtVersion::populateQmlFileFinder(FileInProjectFinder *finder, const Target *target)

View File

@@ -232,6 +232,8 @@ public:
QStringList qtConfigValues() const;
Utils::MacroExpander *macroExpander() const; // owned by the Qt version
static std::unique_ptr<Utils::MacroExpander> createMacroExpander(
const std::function<BaseQtVersion *()> &qtVersion);
static void populateQmlFileFinder(Utils::FileInProjectFinder *finder,
const ProjectExplorer::Target *target);
@@ -315,7 +317,7 @@ private:
mutable QList<ProjectExplorer::Abi> m_qtAbis;
mutable Utils::MacroExpander m_expander;
std::unique_ptr<Utils::MacroExpander> m_expander;
};
}

View File

@@ -47,6 +47,7 @@
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
#include <algorithm>
@@ -311,7 +312,8 @@ void ExamplesListModel::parseExamples(QXmlStreamReader *reader,
item.projectPath = attributes.value(QLatin1String("projectPath")).toString();
item.hasSourceCode = !item.projectPath.isEmpty();
item.projectPath = relativeOrInstallPath(item.projectPath, projectsOffset, examplesInstallPath);
item.imageUrl = attributes.value(QLatin1String("imageUrl")).toString();
item.imageUrl = Utils::StyleHelper::dpiSpecificImageFile(
attributes.value(QLatin1String("imageUrl")).toString());
QPixmapCache::remove(item.imageUrl);
item.docUrl = attributes.value(QLatin1String("docUrl")).toString();
item.isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true");

View File

@@ -413,18 +413,16 @@ public:
QRect pixmapRect = inner;
if (!pm.isNull()) {
painter->setPen(foregroundColor2);
if (item.isVideo)
pixmapRect = inner.adjusted(6, 10, -6, -25);
pixmapRect = inner.adjusted(6, 20, -6, -15);
QPoint pixmapPos = pixmapRect.center();
pixmapPos.rx() -= pm.width() / 2;
pixmapPos.ry() -= pm.height() / 2;
pixmapPos.rx() -= pm.width() / pm.devicePixelRatio() / 2;
pixmapPos.ry() -= pm.height() / pm.devicePixelRatio() / 2;
painter->drawPixmap(pixmapPos, pm);
if (item.isVideo) {
painter->setFont(sizedFont(13, option.widget));
QRect lenRect(x, y + 120, w, 20);
QString videoLen = item.videoLength;
lenRect = fm.boundingRect(lenRect, Qt::AlignHCenter, videoLen);
painter->drawText(lenRect.adjusted(0, 0, 5, 0), videoLen);
painter->drawText(pixmapRect.adjusted(0, 0, 0, painter->font().pixelSize() + 3),
videoLen, Qt::AlignBottom | Qt::AlignHCenter);
}
} else {
// The description text as fallback.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@@ -60,7 +60,11 @@
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Creator - Overview" isVideo="true" videoUrl="https://youtu.be/zAqSiIGdj8M" videoLength="2:06">
<description><![CDATA[Overview of Qt Creator.]]></description>
<tags>qt creator</tags>
<tags>qt creator,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Creator - Introduction" isVideo="true" videoUrl="https://www.youtube.com/watch?v=R6zWLfHIYJw" videoLength="9:29">
<description><![CDATA[Using Qt Creator tutorials and examples to develop Qt applications.]]></description>
<tags>qt creator,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Qt Creator - Getting Started" isVideo="true" videoUrl="https://www.youtube.com/watch?v=nGFmjOiT22Y" videoLength="50:36">

View File

@@ -124,14 +124,26 @@ ProjectExplorer::IOutputParser *QtKitInformation::createOutputParser(const Proje
return nullptr;
}
class QtMacroSubProvider
{
public:
QtMacroSubProvider(Kit *kit)
: expander(BaseQtVersion::createMacroExpander(
[kit] { return QtKitInformation::qtVersion(kit); }))
{}
MacroExpander *operator()() const
{
return expander.get();
}
std::shared_ptr<MacroExpander> expander;
};
void QtKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const
{
QTC_ASSERT(kit, return);
expander->registerSubProvider(
[kit]() -> MacroExpander * {
BaseQtVersion *version = qtVersion(kit);
return version ? version->macroExpander() : nullptr;
});
expander->registerSubProvider(QtMacroSubProvider(kit));
expander->registerVariable("Qt:Name", tr("Name of Qt Version"),
[kit]() -> QString {

View File

@@ -7,7 +7,10 @@
<file>images_areaofinterest.xml</file>
<file>qtcreator_tutorials.xml</file>
<file>images/icons/tutorialicon.png</file>
<file>images/icons/tutorialicon@2x.png</file>
<file>images/icons/videotutorialicon.png</file>
<file>images/icons/videotutorialicon@2x.png</file>
<file>images/icons/qteventicon.png</file>
<file>images/icons/qteventicon@2x.png</file>
</qresource>
</RCC>

View File

@@ -2997,6 +2997,14 @@ bool TextEditorWidget::event(QEvent *e)
void TextEditorWidget::inputMethodEvent(QInputMethodEvent *e)
{
if (e->commitString().isEmpty() && e->preeditString().isEmpty() && e->attributes().isEmpty()) {
// Avoid doing anything when getting bogus events as it can happen on Gnome desktop.
// Otherwise QPlainTextEdit will report content changes for locations where factually
// nothing changed.
// Workaround for QTCREATORBUG-19571
e->accept();
return;
}
if (d->m_inBlockSelectionMode) {
if (!e->commitString().isEmpty())
d->insertIntoBlockSelection(e->commitString());

View File

@@ -52,7 +52,8 @@ WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
QList<RunConfigurationCreationInfo> WinRtRunConfigurationFactory::availableCreators(Target *parent) const
{
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QmakeProject *project = qobject_cast<QmakeProject *>(parent->project());
QTC_ASSERT(project, return {});
const QList<RunConfigurationCreationInfo> list = project->runConfigurationCreators(this);
return Utils::transform(list, [](RunConfigurationCreationInfo rci) {
rci.displayName = tr("Run App Package");

View File

@@ -496,6 +496,37 @@
effect="fill_between_many"
linkedpaths="#path2259-2-0-6,0"
id="path-effect2469-8" />
<linearGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(75,0,0,-70,-74,7774.97)"
y2="111"
x2="1.45"
y1="109.58"
x1="2.76"
id="linear-gradient-7">
<stop
id="stop2568"
stop-color="#6ffe80"
offset="0" />
<stop
id="stop2570"
stop-color="#43ce58"
offset="0.37" />
<stop
id="stop2572"
stop-color="#425fcf"
offset="1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linear-gradient-7"
id="linearGradient2898"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(75,0,0,-75,14430,8326)"
x1="-190.82001"
y1="109.69"
x2="-191.87"
y2="110.83" />
</defs>
<sodipodi:namedview
id="base"
@@ -630,6 +661,79 @@
width="16"
id="transparentBackgroundRect"
style="display:inline;fill:none" />
<g
inkscape:groupmode="layer"
id="layer7"
inkscape:label="Welcome screen thumbnails">
<g
id="src/plugins/qtsupport/images/icons/videotutorialicon">
<rect
id="rect2451"
height="110"
width="176"
class="cls-1"
x="0"
y="0"
style="fill:#26282a" />
<path
d="M 83.73,67.34 V 56.12 l 9.62,5.61 z m -0.53,-14 a 1,1 0 0 0 -1.06,0 1.05,1.05 0 0 0 -0.54,0.93 V 69.2 a 1,1 0 0 0 0.54,0.92 1,1 0 0 0 0.53,0.15 1,1 0 0 0 0.53,-0.15 L 96,62.65 a 1.06,1.06 0 0 0 0,-1.84 z m 32.53,-11.88 v 38.4 a 1.07,1.07 0 0 1 -2.13,0 V 41.47 A 1.07,1.07 0 0 0 112.53,40.4 H 63.47 a 1.07,1.07 0 0 0 -1.07,1.07 v 41.6 h 52.27 a 1.07,1.07 0 0 1 0,2.13 H 61.33 A 1.06,1.06 0 0 1 60.27,84.13 V 41.47 a 3.2,3.2 0 0 1 3.2,-3.2 h 49.06 a 3.2,3.2 0 0 1 3.2,3.2 z M 76.27,91.6 a 1.07,1.07 0 1 1 1.06,-1.07 1.07,1.07 0 0 1 -1.06,1.07 z m 36.26,-2.13 H 79.27 a 3.18,3.18 0 0 0 -6,0 H 65.6 a 1.07,1.07 0 1 0 0,2.13 h 7.66 a 3.18,3.18 0 0 0 6,0 h 33.26 a 1.07,1.07 0 1 0 0,-2.13 z m 5.34,3.2 a 3.21,3.21 0 0 1 -3.2,3.2 H 61.33 a 3.21,3.21 0 0 1 -3.2,-3.2 V 39.33 a 3.21,3.21 0 0 1 3.2,-3.2 h 53.34 a 3.21,3.21 0 0 1 3.2,3.2 z M 114.67,34 H 61.33 A 5.33,5.33 0 0 0 56,39.33 V 92.67 A 5.33,5.33 0 0 0 61.33,98 h 53.34 A 5.33,5.33 0 0 0 120,92.67 V 39.33 A 5.33,5.33 0 0 0 114.67,34 Z"
class="cls-2"
id="video-player"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient2898);fill-opacity:1" />
<path
id="path2480"
style="fill:#17a81a"
d="M 137.7,21.74 V 9 h 2 v 12.74 z m -2.58,-6.22 v 4.1 a 0.91,0.91 0 0 0 0.21,0.58 1,1 0 0 0 0.59,0.25 l -0.06,1.49 a 3.8,3.8 0 0 1 -2.39,-0.66 6.91,6.91 0 0 1 -2.9,0.66 c -1.79,0 -2.68,-1 -2.68,-2.86 a 2.44,2.44 0 0 1 0.73,-2 4,4 0 0 1 2.24,-0.74 l 2.32,-0.2 V 15.5 a 1.33,1.33 0 0 0 -0.31,-1 1.35,1.35 0 0 0 -0.93,-0.29 c -0.77,0 -1.73,0 -2.88,0.14 h -0.58 L 128.41,13 a 15.72,15.72 0 0 1 3.61,-0.46 3.31,3.31 0 0 1 2.38,0.71 3,3 0 0 1 0.72,2.27 z m -4,2.23 a 1.21,1.21 0 0 0 -1.24,1.35 c 0,0.83 0.37,1.24 1.1,1.24 a 7.1,7.1 0 0 0 1.91,-0.29 l 0.32,-0.11 v -2.39 z m -6.99,-6.54 V 9.14 h 2 v 2.07 z m 0,10.53 v -9 h 2 v 9 z m -6.5,0 v -9 h 1.94 v 1.08 a 8.5,8.5 0 0 1 3.06,-1.27 v 2 a 12.57,12.57 0 0 0 -2.64,0.79 l -0.4,0.16 v 6.28 z m -9.05,-8.02 a 4.67,4.67 0 0 1 6.18,0 5.57,5.57 0 0 1 0.92,3.51 5.76,5.76 0 0 1 -0.9,3.52 4.66,4.66 0 0 1 -6.22,0 5.76,5.76 0 0 1 -0.9,-3.52 5.57,5.57 0 0 1 0.92,-3.51 z m 1.47,5.85 a 2.18,2.18 0 0 0 3.24,0 5,5 0 0 0 0.41,-2.36 4.42,4.42 0 0 0 -0.44,-2.32 2.18,2.18 0 0 0 -3.18,0 4.42,4.42 0 0 0 -0.44,2.32 5,5 0 0 0 0.41,2.36 z m -3.56,-5.15 H 104 v 4 a 4.12,4.12 0 0 0 0.17,1.46 c 0.1,0.24 0.38,0.36 0.82,0.36 l 1.48,-0.06 0.09,1.57 a 11.12,11.12 0 0 1 -1.84,0.23 2.55,2.55 0 0 1 -2.09,-0.7 4.41,4.41 0 0 1 -0.57,-2.65 v -4.21 h -1.15 v -1.68 h 1.15 V 10.13 H 104 v 2.61 h 2.49 z m -9.17,-1.68 h 2 v 9 h -2 v -0.55 a 4.93,4.93 0 0 1 -2.43,0.75 2.71,2.71 0 0 1 -2.48,-1 7,7 0 0 1 -0.63,-3.5 v -4.7 h 2 v 4.72 A 5.78,5.78 0 0 0 94,19.64 c 0.18,0.37 0.6,0.56 1.26,0.56 a 4.32,4.32 0 0 0 1.78,-0.36 l 0.27,-0.11 z M 82.67,11.2 V 9.41 h 9 V 11.2 H 88.2 v 10.54 h -2 V 11.2 Z m -12.05,2.52 a 4.65,4.65 0 0 1 6.17,0 5.57,5.57 0 0 1 0.93,3.51 5.76,5.76 0 0 1 -0.9,3.52 3.65,3.65 0 0 1 -3.11,1.19 3.66,3.66 0 0 1 -3.12,-1.19 5.76,5.76 0 0 1 -0.9,-3.52 5.57,5.57 0 0 1 0.93,-3.51 z m 1.47,5.85 a 1.69,1.69 0 0 0 1.62,0.72 1.71,1.71 0 0 0 1.62,-0.72 5.08,5.08 0 0 0 0.41,-2.36 4.42,4.42 0 0 0 -0.44,-2.32 2.18,2.18 0 0 0 -3.18,0 4.41,4.41 0 0 0 -0.45,2.32 4.93,4.93 0 0 0 0.42,2.36 z m -4.7,0.55 0.5,-0.05 v 1.46 a 19.1,19.1 0 0 1 -3.64,0.41 3.44,3.44 0 0 1 -2.87,-1.1 5.65,5.65 0 0 1 -0.87,-3.51 q 0,-4.78 3.91,-4.78 3.91,0 3.78,4.12 l -0.13,1.4 h -5.54 a 2.41,2.41 0 0 0 0.47,1.64 2.27,2.27 0 0 0 1.74,0.52 c 0.87,0 1.75,-0.03 2.65,-0.11 z m -1.08,-3.56 a 3.07,3.07 0 0 0 -0.42,-1.86 1.71,1.71 0 0 0 -1.43,-0.53 1.78,1.78 0 0 0 -1.47,0.55 3,3 0 0 0 -0.48,1.84 z M 58.61,9 v 12.74 h -2 v -0.46 a 5.42,5.42 0 0 1 -2.41,0.66 3,3 0 0 1 -2.58,-1.06 5.92,5.92 0 0 1 -0.82,-3.56 5.81,5.81 0 0 1 0.91,-3.64 3.39,3.39 0 0 1 2.83,-1.13 13.15,13.15 0 0 1 2,0.23 V 9 Z m -2.27,10.87 0.3,-0.12 v -5.33 a 12.14,12.14 0 0 0 -2,-0.18 c -1.22,0 -1.82,1 -1.82,3 a 4.48,4.48 0 0 0 0.42,2.3 1.5,1.5 0 0 0 1.34,0.64 4.66,4.66 0 0 0 1.76,-0.31 z M 46.92,11.21 V 9.14 h 2 v 2.07 z m 0,10.53 v -9 h 2 v 9 z M 43.29,9.41 h 2.09 l -3,12.33 h -3.95 l -3,-12.33 h 2.09 L 39.94,20 h 0.9 z"
inkscape:connector-curvature="0" />
</g>
<g
id="src/plugins/qtsupport/images/icons/tutorialicon"
transform="translate(177)">
<rect
id="rect2579"
height="110"
width="176"
class="cls-1"
x="0"
y="0"
style="fill:#ffffff" />
<path
style="fill:url(#linear-gradient-7)"
d="m 126.67,54 a 1.34,1.34 0 0 0 -1.34,1.33 v 0.44 l -16,6.59 V 60 l 17.85,-7.38 a 1.36,1.36 0 0 0 0.82,-1.24 1.34,1.34 0 0 0 -0.82,-1.23 l -38.67,-16 a 1.38,1.38 0 0 0 -1,0 l -38.67,16 a 1.34,1.34 0 0 0 -0.84,1.18 1.36,1.36 0 0 0 0.82,1.24 l 38.67,16 a 1.24,1.24 0 0 0 1,0 l 14,-5.78 a 1.33,1.33 0 0 0 -1,-2.46 L 88,65.89 52.82,51.33 88,36.78 123.18,51.33 107.87,57.67 93.21,52.19 a 3,3 0 0 0 0.12,-0.86 c 0,-2.24 -2.34,-4 -5.33,-4 -2.99,0 -5.33,1.76 -5.33,4 0,2.24 2.34,4 5.33,4 a 6.41,6.41 0 0 0 3.45,-0.95 l 15.22,5.68 v 4.28 0 28.57 a 4,4 0 1 0 2.66,0 v -7.57 a 16.19,16.19 0 0 0 5.26,-6.9 1.32,1.32 0 0 0 0.08,-0.44 v -9.33 a 1.34,1.34 0 1 0 -2.67,0 v 9.08 a 13.49,13.49 0 0 1 -2.67,4 V 65.24 L 127.17,57.9 A 1.34,1.34 0 0 0 128,56.67 V 55.33 A 1.34,1.34 0 0 0 126.67,54 Z M 85.33,51.33 c 0,-0.54 1,-1.33 2.67,-1.33 1.67,0 2.67,0.79 2.67,1.33 0,0.54 -1,1.34 -2.67,1.34 -1.67,0 -2.67,-0.79 -2.67,-1.34 z M 108,98 A 1.34,1.34 0 1 1 109.33,96.67 1.33,1.33 0 0 1 108,98 Z M 87.49,73.9 48.82,57.9 A 1.34,1.34 0 0 1 48,56.67 v -1.34 a 1.34,1.34 0 0 1 2.67,0 v 0.45 L 88,71.22 102.15,65.36 a 1.36,1.36 0 0 1 1.75,0.73 1.33,1.33 0 0 1 -0.72,1.74 L 88.51,73.9 a 1.35,1.35 0 0 1 -1,0 z m 15.77,15.54 A 34.28,34.28 0 0 1 88,92.67 C 67.33,92.67 61.66,79.07 61.43,78.5 A 1.44,1.44 0 0 1 61.33,78 v -9.33 a 1.34,1.34 0 1 1 2.67,0 v 9 c 0.77,1.67 6.11,11.7 22.67,12.23 V 78 a 1.33,1.33 0 0 1 2.66,0 v 12 a 31,31 0 0 0 12.75,-2.91 1.3327134,1.3327134 0 0 1 1.18,2.39 z m 6.07,13.89 v 4 a 1.33,1.33 0 1 1 -2.66,0 v -4 a 1.33,1.33 0 1 1 2.66,0 z m -4,-1 -1.33,5.33 a 1.33,1.33 0 0 1 -1.29,1 1.86,1.86 0 0 1 -0.33,0 1.34,1.34 0 0 1 -1,-1.62 l 1.34,-5.33 a 1.33,1.33 0 0 1 2.58,0.64 z m 9.34,4.69 a 1.34,1.34 0 0 1 -1,1.62 1.86,1.86 0 0 1 -0.33,0 1.33,1.33 0 0 1 -1.29,-1 l -1.33,-5.34 a 1.33,1.33 0 1 1 2.58,-0.64 l 1.34,5.33 z"
class="cls-2"
id="graduation-hat"
inkscape:connector-curvature="0" />
<path
id="path2598"
style="fill:#222840"
d="M 114,21.74 V 9 h 2 v 12.74 z m -2.57,-6.22 v 4.1 a 0.86,0.86 0 0 0 0.2,0.58 1,1 0 0 0 0.59,0.25 v 1.49 a 3.81,3.81 0 0 1 -2.4,-0.66 6.91,6.91 0 0 1 -2.9,0.66 c -1.79,0 -2.68,-1 -2.68,-2.86 a 2.44,2.44 0 0 1 0.73,-2 4,4 0 0 1 2.24,-0.74 l 2.32,-0.2 V 15.5 a 1.33,1.33 0 0 0 -0.31,-1 1.35,1.35 0 0 0 -0.93,-0.29 c -0.77,0 -1.73,0 -2.88,0.14 h -0.57 L 104.71,13 a 15.72,15.72 0 0 1 3.61,-0.46 3.31,3.31 0 0 1 2.38,0.71 3.05,3.05 0 0 1 0.73,2.27 z m -4,2.23 a 1.21,1.21 0 0 0 -1.25,1.35 c 0,0.83 0.37,1.24 1.1,1.24 a 7,7 0 0 0 1.91,-0.29 l 0.32,-0.11 v -2.39 z m -7,-6.54 V 9.14 h 2 v 2.07 z m 0,10.53 v -9 h 2 v 9 z m -6.5,0 v -9 h 1.95 v 1.08 a 8.42,8.42 0 0 1 3.06,-1.27 v 2 a 12.5,12.5 0 0 0 -2.65,0.79 l -0.4,0.16 v 6.28 z m -9.04,-8.02 a 4.65,4.65 0 0 1 6.17,0 5.57,5.57 0 0 1 0.94,3.51 5.76,5.76 0 0 1 -0.9,3.52 4.67,4.67 0 0 1 -6.23,0 5.76,5.76 0 0 1 -0.9,-3.52 5.57,5.57 0 0 1 0.92,-3.51 z m 1.46,5.85 a 1.71,1.71 0 0 0 1.62,0.72 1.69,1.69 0 0 0 1.62,-0.72 A 4.93,4.93 0 0 0 90,17.21 4.53,4.53 0 0 0 89.56,14.89 1.76,1.76 0 0 0 88,14.2 a 1.74,1.74 0 0 0 -1.59,0.69 4.53,4.53 0 0 0 -0.44,2.32 5.08,5.08 0 0 0 0.38,2.36 z m -3.56,-5.15 h -2.48 v 4 a 4.19,4.19 0 0 0 0.16,1.46 c 0.11,0.24 0.38,0.36 0.83,0.36 l 1.47,-0.06 0.09,1.57 a 10.91,10.91 0 0 1 -1.83,0.23 2.59,2.59 0 0 1 -2.1,-0.7 4.41,4.41 0 0 1 -0.57,-2.65 v -4.21 h -1.15 v -1.68 h 1.15 v -2.61 h 2 v 2.61 h 2.48 z m -9.16,-1.68 h 1.94 v 9 h -1.94 v -0.55 a 5,5 0 0 1 -2.43,0.75 2.72,2.72 0 0 1 -2.49,-1 7,7 0 0 1 -0.63,-3.5 v -4.7 h 2 v 4.72 a 5.78,5.78 0 0 0 0.27,2.18 c 0.18,0.37 0.6,0.56 1.26,0.56 a 4.36,4.36 0 0 0 1.78,-0.36 l 0.27,-0.11 z M 59,11.2 V 9.41 h 9 v 1.79 h -3.5 v 10.54 h -2 V 11.2 Z"
inkscape:connector-curvature="0" />
</g>
<g
id="src/plugins/qtsupport/images/icons/qteventicon"
transform="translate(354)">
<rect
id="rect2709"
height="110"
width="176"
class="cls-1"
x="0"
y="0"
style="fill:#ffffff" />
<path
d="m 120,37.2 v 4.27 a 1.06,1.06 0 0 1 -1.07,1.06 h -1.06 v 24.54 a 1.07,1.07 0 0 1 -2.14,0 v -25.6 a 1.07,1.07 0 0 1 1.07,-1.07 h 1.07 V 38.27 H 58.13 v 2.13 h 54.4 a 1.07,1.07 0 1 1 0,2.13 H 57.07 A 1.06,1.06 0 0 1 56,41.47 V 37.2 a 1.07,1.07 0 0 1 1.07,-1.07 h 29.86 v -1.06 a 1.07,1.07 0 1 1 2.14,0 v 1.06 h 29.86 A 1.07,1.07 0 0 1 120,37.2 Z M 69.87,51.07 h 8.53 a 1.07,1.07 0 0 0 0,-2.14 h -8.53 a 1.07,1.07 0 0 0 0,2.14 z m 0,6.4 h 19.2 a 1.07,1.07 0 0 0 0,-2.14 h -19.2 a 1.07,1.07 0 0 0 0,2.14 z m 17.06,-6.4 a 1.07,1.07 0 0 0 0,-2.14 h -4.26 a 1.07,1.07 0 0 0 0,2.14 z m -17.06,12.8 h 3.2 a 1.07,1.07 0 0 0 0,-2.14 h -3.2 a 1.07,1.07 0 0 0 0,2.14 z m 19.2,-2.14 H 78.4 a 1.07,1.07 0 0 0 0,2.14 h 10.67 a 1.07,1.07 0 0 0 0,-2.14 z m 19.27,6.42 a 1.11,1.11 0 0 0 -1.13,0.92 L 104,92.52 a 1.06,1.06 0 0 0 0.91,1.2 h 0.15 a 1.06,1.06 0 0 0 1.05,-0.92 l 3.08,-22.52 c 3.68,0.09 6.2,0.79 7.49,2.08 a 4.34,4.34 0 0 1 1.18,3.23 v 17.08 a 1.07,1.07 0 0 0 2.13,0 V 75.6 a 6.46,6.46 0 0 0 -1.8,-4.74 c -1.83,-1.82 -5.06,-2.71 -9.86,-2.71 z m -9.68,0.91 3.2,23.46 a 1.07,1.07 0 0 1 -2.12,0.29 L 96.67,70.27 h -17.2 v 4.26 H 91.2 a 1.06,1.06 0 0 1 1.06,1 l 2.13,21.34 a 1.05,1.05 0 0 1 -1,1.16 h -0.11 a 1.07,1.07 0 0 1 -1.06,-1 l -2,-20.37 h -14 c -5,0 -7.47,-4.79 -7.47,-7.47 a 1.07,1.07 0 0 1 1.07,-1.07 H 97.6 a 1.08,1.08 0 0 1 1.06,0.93 z m -21.33,1.21 h -6.21 c 0.52,1.74 2.16,4.26 5.15,4.26 h 1.06 z m 27.74,0 a 2.14,2.14 0 1 0 -4.27,0 2.11,2.11 0 0 0 1.07,1.83 v 7.77 a 1.07,1.07 0 0 0 2.13,0 V 72.1 a 2.14,2.14 0 0 0 1.07,-1.83 z m 6.4,-19.2 v 0.28 a 2.15,2.15 0 0 1 1.06,1.85 v 2.13 a 2.12,2.12 0 0 1 -1.1,1.87 12.85,12.85 0 0 1 -1.14,3.94 c -1,1.94 -2.43,4.86 -7.36,4.86 C 98,66 96.55,63.08 95.58,61.14 A 12.55,12.55 0 0 1 94.44,57.2 2.13,2.13 0 0 1 93.33,55.33 V 53.2 a 2.13,2.13 0 0 1 1.07,-1.85 v -0.28 a 6.41,6.41 0 0 1 6.4,-6.4 h 4.27 a 6.41,6.41 0 0 1 6.4,6.4 z m -1.07,2.13 a 1.07,1.07 0 0 1 -1.07,-1.07 v -1.06 a 4.27,4.27 0 0 0 -4.26,-4.27 h -4.27 a 4.27,4.27 0 0 0 -4.27,4.27 v 1.06 a 1.06,1.06 0 0 1 -1.06,1.07 v 2.13 a 1.06,1.06 0 0 1 1.06,1.07 9.93,9.93 0 0 0 1,3.79 c 1.11,2.22 2.09,3.68 5.44,3.68 3.35,0 4.34,-1.46 5.45,-3.68 a 10,10 0 0 0 1,-3.79 1.07,1.07 0 0 1 1.07,-1.07 V 53.2 Z m -4.27,0 h -1.06 a 1.07,1.07 0 1 0 0,2.13 h 1.06 a 1.07,1.07 0 1 0 0,-2.13 z m -5.33,0 h -1.07 a 1.07,1.07 0 0 0 0,2.13 h 1.07 a 1.07,1.07 0 1 0 0,-2.13 z m 11.73,27.73 A 1.06,1.06 0 0 0 111.47,82 v 14.93 a 1.07,1.07 0 1 0 2.13,0 V 82 a 1.07,1.07 0 0 0 -1.07,-1.07 z M 88,80.93 H 63.47 a 3.12,3.12 0 0 1 -3.2,-3.2 v -32 a 1.07,1.07 0 0 0 -2.14,0 v 32 a 5.29,5.29 0 0 0 5.34,5.34 H 88 a 1.07,1.07 0 0 0 0,-2.14 z"
class="cls-2"
id="presentation-man"
inkscape:connector-curvature="0"
style="fill:#222840" />
<path
id="path2724"
style="fill:#17a81a"
d="m 108.63,21.74 h -2 V 9 h 2 v 7.36 l 1.11,-0.11 2.13,-3.51 h 2.19 l -2.59,4.26 2.74,4.78 H 112 l -2.2,-3.78 -1.17,0.12 z m -6.41,0 V 9 h 2 v 12.74 z m -2.57,-6.22 v 4.1 a 0.86,0.86 0 0 0 0.2,0.58 1,1 0 0 0 0.59,0.25 l -0.06,1.49 A 3.8,3.8 0 0 1 98,21.28 6.91,6.91 0 0 1 95.1,21.94 c -1.79,0 -2.68,-1 -2.68,-2.86 a 2.44,2.44 0 0 1 0.73,-2 4,4 0 0 1 2.24,-0.74 l 2.32,-0.2 V 15.5 a 1.33,1.33 0 0 0 -0.31,-1 1.35,1.35 0 0 0 -0.93,-0.29 c -0.77,0 -1.73,0 -2.88,0.14 H 93.01 L 92.93,13 a 15.72,15.72 0 0 1 3.61,-0.46 3.31,3.31 0 0 1 2.38,0.71 3.05,3.05 0 0 1 0.73,2.27 z m -4,2.23 a 1.21,1.21 0 0 0 -1.24,1.35 c 0,0.83 0.37,1.24 1.1,1.24 a 7,7 0 0 0 1.91,-0.29 l 0.32,-0.11 V 17.55 Z M 84,11.2 V 9.41 h 9 v 1.79 h -3.49 v 10.54 h -2 V 11.2 Z m -4.62,3.22 h -2.49 v 4 a 4.12,4.12 0 0 0 0.17,1.46 c 0.1,0.24 0.38,0.36 0.82,0.36 l 1.48,-0.06 0.09,1.57 A 11,11 0 0 1 77.61,21.98 2.55,2.55 0 0 1 75.52,21.28 4.41,4.41 0 0 1 75,18.59 V 14.42 H 73.8 V 12.74 H 75 v -2.61 h 1.94 v 2.61 h 2.49 z m -11.94,7.52 c -1.87,0 -3.17,-0.5 -3.91,-1.51 a 8.16,8.16 0 0 1 -1.11,-4.78 8.43,8.43 0 0 1 1.13,-4.85 c 0.75,-1.06 2,-1.58 3.89,-1.58 1.89,0 3.15,0.52 3.89,1.57 a 8.41,8.41 0 0 1 1.12,4.85 11.08,11.08 0 0 1 -0.45,3.49 4,4 0 0 1 -1.5,2 l 1.5,2.47 -1.86,0.86 -1.6,-2.63 a 3.68,3.68 0 0 1 -1.1,0.11 z m -2.34,-2.8 a 3.13,3.13 0 0 0 4.68,0 7.43,7.43 0 0 0 0.6,-3.5 7.78,7.78 0 0 0 -0.62,-3.58 3,3 0 0 0 -4.64,0 7.56,7.56 0 0 0 -0.63,3.56 7.47,7.47 0 0 0 0.61,3.52 z"
inkscape:connector-curvature="0" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer6"

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 337 KiB

View File

@@ -57,6 +57,8 @@ public:
bool isModificationGroupActive() const;
void setModificationGroupActive(bool active);
void applyModificationGroupChanges();
using RewriterView::auxiliaryDataAsQML;
};
} // QmlDesigner

View File

@@ -59,6 +59,7 @@
#include <utils/fileutils.h>
#include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljssimplereader.h>
#include <extensionsystem/pluginmanager.h>
#include <QPlainTextEdit>
@@ -8208,5 +8209,123 @@ void tst_TestCore::changeGradientId()
}
}
static void checkNode(QmlJS::SimpleReaderNode::Ptr node, TestRewriterView *view);
static void checkChildNodes(QmlJS::SimpleReaderNode::Ptr node, TestRewriterView *view)
{
for (auto child : node->children())
checkNode(child, view);
}
static void checkNode(QmlJS::SimpleReaderNode::Ptr node, TestRewriterView *view)
{
QVERIFY(node);
QVERIFY(node->propertyNames().contains("i"));
const int internalId = node->property("i").toInt();
const ModelNode modelNode = view->modelNodeForInternalId(internalId);
QVERIFY(modelNode.isValid());
auto properties = node->properties();
for (auto i = properties.begin(); i != properties.end(); ++i) {
if (i.key() != "i")
QCOMPARE(i.value(), modelNode.auxiliaryData(i.key().toUtf8()));
}
checkChildNodes(node, view);
}
void tst_TestCore::writeAnnotations()
{
const QLatin1String qmlCode("\n"
"import QtQuick 2.1\n"
"\n"
"Rectangle {\n"
" Item {\n"
" }\n"
"\n"
" MouseArea {\n"
" x: 3\n"
" y: 3\n"
" }\n"
"}");
const QLatin1String metaCode("\n/*##^## Designer {\n D{i:0;x:10}D{i:1;test:true;x:10;test2:\"string\"}"
"D{i:2;test:true;x:10;test2:\"string\"}\n}\n ##^##*/\n");
QPlainTextEdit textEdit;
textEdit.setPlainText(qmlCode);
NotIndentingTextEditModifier textModifier(&textEdit);
QScopedPointer<Model> model(Model::create("QtQuick.Item", 2, 1));
QVERIFY(model.data());
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
testRewriterView->setTextModifier(&textModifier);
model->attachView(testRewriterView.data());
QVERIFY(model.data());
ModelNode rootModelNode(testRewriterView->rootModelNode());
QVERIFY(rootModelNode.isValid());
rootModelNode.setAuxiliaryData("x", 10);
for (const auto child : rootModelNode.allSubModelNodes()) {
child.setAuxiliaryData("x", 10);
child.setAuxiliaryData("test", true);
child.setAuxiliaryData("test2", "string");
}
const QString metaSource = testRewriterView->auxiliaryDataAsQML();
QmlJS::SimpleReader reader;
checkChildNodes(reader.readFromSource(metaSource), testRewriterView.data());
testRewriterView->writeAuxiliaryData();
const QString textWithMeta = testRewriterView->textModifier()->text();
testRewriterView->writeAuxiliaryData();
QCOMPARE(textWithMeta.length(), testRewriterView->textModifier()->text().length());
}
void tst_TestCore::readAnnotations()
{
const QLatin1String qmlCode("\n"
"import QtQuick 2.1\n"
"\n"
"Rectangle {\n"
" Item {\n"
" }\n"
"\n"
" MouseArea {\n"
" x: 3\n"
" y: 3\n"
" }\n"
"}");
const QLatin1String metaCode("\n/*##^## Designer {\n D{i:0;x:10}D{i:1;test:true;x:10;test2:\"string\"}"
"D{i:2;test:true;x:10;test2:\"string\"}\n}\n ##^##*/\n");
const QLatin1String metaCodeQmlCode("Designer {\n D{i:0;x:10}D{i:1;test2:\"string\";x:10;test:true}"
"D{i:2;test2:\"string\";x:10;test:true}\n}\n");
QPlainTextEdit textEdit;
textEdit.setPlainText(qmlCode + metaCode);
NotIndentingTextEditModifier textModifier(&textEdit);
QScopedPointer<Model> model(Model::create("QtQuick.Item", 2, 1));
QVERIFY(model.data());
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
testRewriterView->setTextModifier(&textModifier);
model->attachView(testRewriterView.data());
QVERIFY(model.data());
ModelNode rootModelNode(testRewriterView->rootModelNode());
QVERIFY(rootModelNode.isValid());
testRewriterView->restoreAuxiliaryData();
const QString metaSource = testRewriterView->auxiliaryDataAsQML();
QCOMPARE(metaSource.length(), QString(metaCodeQmlCode).length());
}
QTEST_MAIN(tst_TestCore);

View File

@@ -229,4 +229,8 @@ private slots:
// Object bindings as properties:
void loadGradient();
void changeGradientId();
// QMLAnnotations
void writeAnnotations();
void readAnnotations();
};