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 --- a/tools/clang/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h +++ b/tools/clang/include/clang/Sema/Sema.h
@@ -2707,7 +2707,8 @@ @@ -2707,7 +2707,8 @@
OverloadCandidateSet &CandidateSet, OverloadCandidateSet &CandidateSet,
TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr, TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
@@ -10,8 +10,8 @@
void AddMethodCandidate(DeclAccessPair FoundDecl, void AddMethodCandidate(DeclAccessPair FoundDecl,
QualType ObjectType, QualType ObjectType,
Expr::Classification ObjectClassification, Expr::Classification ObjectClassification,
--- a/lib/Sema/SemaCodeComplete.cpp --- a/tools/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp +++ b/tools/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4396,9 +4396,11 @@ @@ -4396,9 +4396,11 @@
ArgExprs.append(Args.begin(), Args.end()); ArgExprs.append(Args.begin(), Args.end());
UnresolvedSet<8> Decls; UnresolvedSet<8> Decls;
@@ -25,8 +25,8 @@
} else { } else {
FunctionDecl *FD = nullptr; FunctionDecl *FD = nullptr;
if (auto MCE = dyn_cast<MemberExpr>(NakedFn)) if (auto MCE = dyn_cast<MemberExpr>(NakedFn))
--- a/lib/Sema/SemaOverload.cpp --- a/tools/clang/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp +++ b/tools/clang/lib/Sema/SemaOverload.cpp
@@ -6343,24 +6343,36 @@ @@ -6343,24 +6343,36 @@
OverloadCandidateSet& CandidateSet, OverloadCandidateSet& CandidateSet,
TemplateArgumentListInfo *ExplicitTemplateArgs, TemplateArgumentListInfo *ExplicitTemplateArgs,
@@ -72,8 +72,8 @@
SuppressUserConversions, PartialOverloading); SuppressUserConversions, PartialOverloading);
} }
} else { } else {
--- a/test/Index/complete-call.cpp --- a/tools/clang/test/Index/complete-call.cpp
+++ b/test/Index/complete-call.cpp +++ b/tools/clang/test/Index/complete-call.cpp
@@ -94,6 +94,24 @@ @@ -94,6 +94,24 @@
s.foo_7(42,); 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 index 1b07ec60ce..46ed08d1cf 100644
--- a/lib/Sema/SemaOverload.cpp --- a/tools/clang/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp +++ b/tools/clang/lib/Sema/SemaOverload.cpp
@@ -6371,57 +6371,54 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns, @@ -6321,57 +6321,56 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns,
bool FirstArgumentIsBase) { bool FirstArgumentIsBase) {
for (UnresolvedSetIterator F = Fns.begin(), E = Fns.end(); F != E; ++F) { for (UnresolvedSetIterator F = Fns.begin(), E = Fns.end(); F != E; ++F) {
NamedDecl *D = F.getDecl()->getUnderlyingDecl(); NamedDecl *D = F.getDecl()->getUnderlyingDecl();
@@ -56,8 +56,7 @@ index 1b07ec60ce..46ed08d1cf 100644
+ Expr::Classification ObjectClassification; + Expr::Classification ObjectClassification;
+ if (Args.size() > 0) { + if (Args.size() > 0) {
if (Expr *E = Args[0]) { if (Expr *E = Args[0]) {
- // Use the explit base to restrict the lookup: // Use the explit base to restrict the lookup:
+ // Use the explicit base to restrict the lookup:
ObjectType = E->getType(); ObjectType = E->getType();
ObjectClassification = E->Classify(Context); ObjectClassification = E->Classify(Context);
} // .. else there is an implit base. } // .. else there is an implit base.
@@ -65,19 +64,17 @@ index 1b07ec60ce..46ed08d1cf 100644
+ } + }
+ if (IsTemplate) + if (IsTemplate)
AddMethodTemplateCandidate( AddMethodTemplateCandidate(
- FunTmpl, F.getPair(), FunTmpl, F.getPair(),
- cast<CXXRecordDecl>(FunTmpl->getDeclContext()), cast<CXXRecordDecl>(FunTmpl->getDeclContext()),
- ExplicitTemplateArgs, ObjectType, ObjectClassification, ExplicitTemplateArgs, ObjectType, ObjectClassification,
- Args.slice(1), CandidateSet, SuppressUserConversions, - Args.slice(1), CandidateSet, SuppressUserConversions,
- PartialOverloading); + FunctionArgs, CandidateSet, SuppressUserConversions,
PartialOverloading);
- } else { - } else {
- AddTemplateOverloadCandidate(FunTmpl, F.getPair(), - AddTemplateOverloadCandidate(FunTmpl, F.getPair(),
- ExplicitTemplateArgs, Args, - ExplicitTemplateArgs, Args,
- CandidateSet, SuppressUserConversions, - CandidateSet, SuppressUserConversions,
- PartialOverloading); - PartialOverloading);
+ FunTmpl, F.getPair(), cast<CXXRecordDecl>(FD), ExplicitTemplateArgs,
+ ObjectType, ObjectClassification, FunctionArgs, CandidateSet,
+ SuppressUserConversions, PartialOverloading);
+ else + else
+ AddMethodCandidate(cast<CXXMethodDecl>(FD), F.getPair(), + AddMethodCandidate(cast<CXXMethodDecl>(FD), F.getPair(),
+ cast<CXXMethodDecl>(FD)->getParent(), ObjectType, + 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 index ca116485ac..35f2009066 100644
--- a/test/Index/complete-call.cpp --- a/tools/clang/test/Index/complete-call.cpp
+++ b/test/Index/complete-call.cpp +++ b/tools/clang/test/Index/complete-call.cpp
@@ -112,6 +112,33 @@ struct Bar2 : public Bar { @@ -112,6 +112,33 @@ struct Bar2 : public Bar {
} }
}; };

View File

@@ -13,6 +13,7 @@ Module {
Depends { name: "vcs"; condition: hasVcs } Depends { name: "vcs"; condition: hasVcs }
Properties { Properties {
condition: hasVcs condition: hasVcs
vcs.headerFileName: undefined
vcs.repoDir: { vcs.repoDir: {
// TODO: Could something like this be incorporated into the vcs module? // TODO: Could something like this be incorporated into the vcs module?
// Currently, the default repo dir is project.sourceDirectory, which // 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) InstanceContainer::InstanceContainer(qint32 instanceId,
: m_instanceId(instanceId), m_type(properDelemitingOfType(type)), m_majorNumber(majorNumber), m_minorNumber(minorNumber), m_componentPath(componentPath), const TypeName &type,
m_nodeSource(nodeSource), m_nodeSourceType(nodeSourceType), m_metaType(metaType) 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); 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) QDataStream &operator<<(QDataStream &out, const InstanceContainer &container)
{ {
out << container.instanceId(); out << container.instanceId();
@@ -100,6 +125,7 @@ QDataStream &operator<<(QDataStream &out, const InstanceContainer &container)
out << container.nodeSource(); out << container.nodeSource();
out << qint32(container.nodeSourceType()); out << qint32(container.nodeSourceType());
out << qint32(container.metaType()); out << qint32(container.metaType());
out << qint32(container.metaFlags());
return out; return out;
} }
@@ -115,6 +141,7 @@ QDataStream &operator>>(QDataStream &in, InstanceContainer &container)
in >> container.m_nodeSource; in >> container.m_nodeSource;
in >> container.m_nodeSourceType; in >> container.m_nodeSourceType;
in >> container.m_metaType; in >> container.m_metaType;
in >> container.m_metaFlags;
return in; return in;
} }

View File

@@ -54,8 +54,22 @@ public:
ItemMetaType ItemMetaType
}; };
enum NodeFlag {
ParentTakesOverRendering = 1
};
Q_DECLARE_FLAGS(NodeFlags, NodeFlag)
InstanceContainer(); 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; qint32 instanceId() const;
TypeName type() const; TypeName type() const;
@@ -65,6 +79,8 @@ public:
QString nodeSource() const; QString nodeSource() const;
NodeSourceType nodeSourceType() const; NodeSourceType nodeSourceType() const;
NodeMetaType metaType() const; NodeMetaType metaType() const;
bool checkFlag(NodeFlag flag) const;
NodeFlags metaFlags() const;
private: private:
qint32 m_instanceId = -1; qint32 m_instanceId = -1;
@@ -75,6 +91,7 @@ private:
QString m_nodeSource; QString m_nodeSource;
qint32 m_nodeSourceType = 0; qint32 m_nodeSourceType = 0;
qint32 m_metaType = 0; qint32 m_metaType = 0;
qint32 m_metaFlags = 0;
}; };
QDebug operator <<(QDebug debug, const InstanceContainer &command); QDebug operator <<(QDebug debug, const InstanceContainer &command);
@@ -82,3 +99,4 @@ QDebug operator <<(QDebug debug, const InstanceContainer &command);
} // namespace QmlDesigner } // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::InstanceContainer) 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); m_signalSpy.setObjectNodeInstance(objectNodeInstance);
} }
void ObjectNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance) void ObjectNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags /*flags*/)
{ {
initializePropertyWatcher(objectNodeInstance); initializePropertyWatcher(objectNodeInstance);
QmlPrivateGate::registerNodeInstanceMetaObject(objectNodeInstance->object(), objectNodeInstance->nodeInstanceServer()->engine()); QmlPrivateGate::registerNodeInstanceMetaObject(objectNodeInstance->object(), objectNodeInstance->nodeInstanceServer()->engine());

View File

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

View File

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

View File

@@ -46,7 +46,8 @@ public:
static Pointer create(QObject *objectToBeWrapped); static Pointer create(QObject *objectToBeWrapped);
static void createEffectItem(bool createEffectItem); 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; QQuickItem *contentItem() const override;
bool hasContent() const override; bool hasContent() const override;

View File

@@ -188,7 +188,9 @@ Internal::ObjectNodeInstance::Pointer ServerNodeInstance::createInstance(QObject
return instance; 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(instanceContainer.instanceId() != -1);
Q_ASSERT(nodeInstanceServer); Q_ASSERT(nodeInstanceServer);
@@ -229,7 +231,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
instance.internalInstance()->setInstanceId(instanceContainer.instanceId()); instance.internalInstance()->setInstanceId(instanceContainer.instanceId());
instance.internalInstance()->initialize(instance.m_nodeInstance); instance.internalInstance()->initialize(instance.m_nodeInstance, instanceContainer.metaFlags());
return instance; return instance;
} }

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

@@ -239,7 +239,8 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
QList<RunConfigurationCreationInfo> QList<RunConfigurationCreationInfo>
CMakeRunConfigurationFactory::availableCreators(Target *parent) const 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); const QStringList titles = project->buildTargetTitles(true);
return Utils::transform(titles, [this](const QString &title) { return convert(title, title); }); 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 ALLOW_ALL_TEMPLATES[] = "Core/NewDialog/AllowAllTemplates";
const char SHOW_PLATOFORM_FILTER[] = "Core/NewDialog/ShowPlatformFilter"; const char SHOW_PLATOFORM_FILTER[] = "Core/NewDialog/ShowPlatformFilter";
const char BLACKLISTED_CATEGORIES_KEY[] = "Core/NewDialog/BlacklistedCategories"; const char BLACKLISTED_CATEGORIES_KEY[] = "Core/NewDialog/BlacklistedCategories";
const char ALTERNATIVE_WIZARD_STYLE[] = "Core/NewDialog/AlternativeWizardStyle";
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
@@ -205,6 +206,21 @@ NewDialog::NewDialog(QWidget *parent) :
m_ui->templatesView->setModel(m_filterProxyModel); m_ui->templatesView->setModel(m_filterProxyModel);
m_ui->templatesView->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); 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, connect(m_ui->templateCategoryView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &NewDialog::currentCategoryChanged); 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) { for (int i = 0; i < history.size(); ++i) {
const EditLocation &item = history.at(i); const EditLocation &item = history.at(i);
if (item.document == document if (item.document == document
|| !DocumentModel::indexOfFilePath(FileName::fromString(item.fileName))) { || (!item.document
&& !DocumentModel::indexOfFilePath(FileName::fromString(item.fileName)))) {
history.removeAt(i--); history.removeAt(i--);
} }
} }

View File

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

View File

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

View File

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

View File

@@ -30,82 +30,82 @@
<widget class="QListWidget" name="checksList"> <widget class="QListWidget" name="checksList">
<item> <item>
<property name="text"> <property name="text">
<string>android-*</string> <string notr="true">android-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>boost-*</string> <string notr="true">boost-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>bugprone-*</string> <string notr="true">bugprone-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>cert-*</string> <string notr="true">cert-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>cppcoreguidelines-*</string> <string notr="true">cppcoreguidelines-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>clang-analyzer-*</string> <string notr="true">clang-analyzer-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>clang-diagnostic-*</string> <string notr="true">clang-diagnostic-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>google-*</string> <string notr="true">google-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>hicpp-*</string> <string notr="true">hicpp-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>llvm-*</string> <string notr="true">llvm-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>misc-*</string> <string notr="true">misc-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>modernize-*</string> <string notr="true">modernize-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>mpi-*</string> <string notr="true">mpi-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>objc-*</string> <string notr="true">objc-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>performance-*</string> <string notr="true">performance-*</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>readability-*</string> <string notr="true">readability-*</string>
</property> </property>
</item> </item>
</widget> </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 // Qt's various build paths for unpatched versions
QStringList qtBuildPaths(); QStringList qtBuildPaths();
void addDebugInfoTask(unsigned id, const QString &cmd);
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -94,6 +94,7 @@
#include <projectexplorer/buildmanager.h> #include <projectexplorer/buildmanager.h>
#include <projectexplorer/devicesupport/deviceprocessesdialog.h> #include <projectexplorer/devicesupport/deviceprocessesdialog.h>
#include <projectexplorer/devicesupport/deviceprocesslist.h> #include <projectexplorer/devicesupport/deviceprocesslist.h>
#include <projectexplorer/itaskhandler.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorericons.h> #include <projectexplorer/projectexplorericons.h>
@@ -569,6 +570,42 @@ static Kit *findUniversalCdbKit()
return KitManager::kit(cdbPredicate()); 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 // DebuggerPluginPrivate
@@ -1022,6 +1059,8 @@ public:
DebuggerItemManager m_debuggerItemManager; DebuggerItemManager m_debuggerItemManager;
QList<IOptionsPage *> m_optionPages; QList<IOptionsPage *> m_optionPages;
IContext m_debugModeContext; IContext m_debugModeContext;
DebugInfoTaskHandler m_debugInfoTaskHandler;
}; };
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
@@ -2947,6 +2986,11 @@ QMessageBox *showMessageBox(int icon, const QString &title,
return mb; return mb;
} }
void addDebugInfoTask(unsigned id, const QString &cmd)
{
dd->m_debugInfoTaskHandler.addTask(id, cmd);
}
bool isReverseDebuggingEnabled() bool isReverseDebuggingEnabled()
{ {
static bool enabled = qEnvironmentVariableIsSet("QTC_DEBUGGER_ENABLE_REVERSE"); static bool enabled = qEnvironmentVariableIsSet("QTC_DEBUGGER_ENABLE_REVERSE");

View File

@@ -55,7 +55,6 @@
#include <coreplugin/messagebox.h> #include <coreplugin/messagebox.h>
#include <projectexplorer/devicesupport/deviceprocess.h> #include <projectexplorer/devicesupport/deviceprocess.h>
#include <projectexplorer/itaskhandler.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
@@ -131,52 +130,6 @@ static bool isMostlyHarmlessMessage(const QStringRef &msg)
"Invalid argument\\n"; "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 // GdbEngine
@@ -190,9 +143,6 @@ GdbEngine::GdbEngine()
m_gdbOutputCodec = QTextCodec::codecForLocale(); m_gdbOutputCodec = QTextCodec::codecForLocale();
m_inferiorOutputCodec = QTextCodec::codecForLocale(); m_inferiorOutputCodec = QTextCodec::codecForLocale();
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
//ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler);
m_commandTimer.setSingleShot(true); m_commandTimer.setSingleShot(true);
connect(&m_commandTimer, &QTimer::timeout, connect(&m_commandTimer, &QTimer::timeout,
this, &GdbEngine::commandTimeout); this, &GdbEngine::commandTimeout);
@@ -222,10 +172,6 @@ GdbEngine::GdbEngine()
GdbEngine::~GdbEngine() GdbEngine::~GdbEngine()
{ {
//ExtensionSystem::PluginManager::removeObject(m_debugInfoTaskHandler);
delete m_debugInfoTaskHandler;
m_debugInfoTaskHandler = 0;
// Prevent sending error messages afterwards. // Prevent sending error messages afterwards.
disconnect(); disconnect();
} }
@@ -434,10 +380,7 @@ void GdbEngine::handleResponse(const QString &buff)
FileName(), 0, Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); FileName(), 0, Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::addTask(task); TaskHub::addTask(task);
Internal::addDebugInfoTask(task.taskId, cmd);
DebugInfoTask dit;
dit.command = cmd;
m_debugInfoTaskHandler->addTask(task.taskId, dit);
} }
} }
@@ -4184,11 +4127,6 @@ void GdbEngine::scheduleTestResponse(int testCase, const QString &response)
m_scheduledTestResponses[token] = response; m_scheduledTestResponses[token] = response;
} }
void GdbEngine::requestDebugInformation(const DebugInfoTask &task)
{
QProcess::startDetached(task.command);
}
QString GdbEngine::msgGdbStopFailed(const QString &why) QString GdbEngine::msgGdbStopFailed(const QString &why)
{ {
return tr("The gdb process could not be stopped:\n%1").arg(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; QHash<int, QString> m_scheduledTestResponses;
QSet<int> m_testCases; QSet<int> m_testCases;
// Debug information
friend class DebugInfoTaskHandler;
void requestDebugInformation(const DebugInfoTask &task);
DebugInfoTaskHandler *m_debugInfoTaskHandler;
bool m_systemDumpersLoaded = false; bool m_systemDumpersLoaded = false;
static QString msgGdbStopFailed(const QString &why); 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), connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
this, &ChangeSelectionDialog::setDetails); 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(); m_process->closeWriteChannel();
if (!m_process->waitForStarted()) if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git.")); 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; bool controlPressed = e->modifiers() & Qt::ControlModifier;
const QString link = linkAt(e->pos()); 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)); emit m_parent->newPageRequested(QUrl(link));
return; return;
} }

View File

@@ -53,7 +53,8 @@ IosRunConfigurationFactory::IosRunConfigurationFactory()
QList<RunConfigurationCreationInfo> QList<RunConfigurationCreationInfo>
IosRunConfigurationFactory::availableCreators(Target *parent) const 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, return project->runConfigurationCreators(this, {ProjectType::ApplicationTemplate,
ProjectType::SharedLibraryTemplate}); ProjectType::SharedLibraryTemplate});
} }

View File

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

View File

@@ -55,6 +55,7 @@
#include <QToolButton> #include <QToolButton>
#include <QPainter> #include <QPainter>
#include <QAction> #include <QAction>
#include <QLineEdit>
#include <QMenu> #include <QMenu>
#include <memory> #include <memory>
@@ -415,8 +416,23 @@ void ProjectTreeWidget::collapseAll()
void ProjectTreeWidget::editCurrentItem() void ProjectTreeWidget::editCurrentItem()
{ {
m_delayedRename.clear(); m_delayedRename.clear();
if (m_view->selectionModel()->currentIndex().isValid()) const QModelIndex currentIndex = m_view->selectionModel()->currentIndex();
m_view->edit(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) void ProjectTreeWidget::renamed(const FileName &oldPath, const FileName &newPath)

View File

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

View File

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

View File

@@ -634,7 +634,7 @@ void QbsBuildStepConfigWidget::updateState()
} }
if (m_step->isQmlDebuggingEnabled()) 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); m_ui->commandLineTextEdit->setPlainText(command);
QString summary = tr("<b>Qbs:</b> %1").arg(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 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}); 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 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)); return project->hasApplicationProFile(Utils::FileName::fromString(buildTarget));
} }
QList<RunConfigurationCreationInfo> QList<RunConfigurationCreationInfo>
DesktopQmakeRunConfigurationFactory::availableCreators(Target *parent) const 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); return project->runConfigurationCreators(this);
} }

View File

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

View File

@@ -874,7 +874,7 @@ PropertyName getIndexPropertyName(const ModelNode &modelNode)
return PropertyName(); 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()) { if (!property.exists() || property.isVariantProperty()) {
/* Using QmlObjectNode ensures we take states into account. */ /* 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) void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem *> &itemList)
{ {
foreach (FormEditorItem *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))) { if (!m_entryList.contains(EntryPair(formEditorItem, 0))) {
QGraphicsRectItem *indicatorShape = new QGraphicsRectItem(m_layerItem); QGraphicsRectItem *indicatorShape = new QGraphicsRectItem(m_layerItem);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -193,6 +193,14 @@ QString NodeHints::indexPropertyForStackedContainer() const
return Internal::evaluateExpression(expression, modelNode(), ModelNode()).toString(); 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 QHash<QString, QString> NodeHints::hints() const
{ {
return m_hints; return m_hints;
@@ -277,7 +285,7 @@ bool JSObject::potentialParentIsRoot() const
bool JSObject::potentialChildIsRoot() const bool JSObject::potentialChildIsRoot() const
{ {
return m_otherNode.isValid() && m_otherNode.isRootNode(); return m_otherNode.isValid() && m_otherNode.isRootNode();
} }
bool JSObject::isSubclassOf(const QString &typeName) bool JSObject::isSubclassOf(const QString &typeName)
@@ -303,7 +311,7 @@ bool JSObject::rootItemIsSubclassOf(const QString &typeName)
bool JSObject::currentParentIsSubclassOf(const QString &typeName) bool JSObject::currentParentIsSubclassOf(const QString &typeName)
{ {
if (m_modelNode.hasParentProperty() if (m_modelNode.hasParentProperty()
&& m_modelNode.parentProperty().isValid()) { && m_modelNode.parentProperty().isValid()) {
NodeMetaInfo metaInfo = m_modelNode.parentProperty().parentModelNode().metaInfo(); NodeMetaInfo metaInfo = m_modelNode.parentProperty().parentModelNode().metaInfo();
if (metaInfo.isValid()) if (metaInfo.isValid())
return metaInfo.isSubclassOf(typeName.toUtf8()); return metaInfo.isSubclassOf(typeName.toUtf8());

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) static void syncBindingProperties(ModelNode &outputNode, const ModelNode &inputNode, const QHash<QString, QString> &idRenamingHash)
{ {
foreach (const BindingProperty &bindingProperty, inputNode.bindingProperties()) { 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()); NodeMetaInfo nodeMetaInfo = view->model()->metaInfo(modelNode.type());
ModelNode newNode(view->createModelNode(modelNode.type(), nodeMetaInfo.majorVersion(), nodeMetaInfo.minorVersion(), ModelNode newNode(view->createModelNode(modelNode.type(), nodeMetaInfo.majorVersion(), nodeMetaInfo.minorVersion(),
propertyList, variantPropertyList, modelNode.nodeSource(), modelNode.nodeSourceType())); propertyList, variantPropertyList, modelNode.nodeSource(), modelNode.nodeSourceType()));
syncAuxiliaryProperties(newNode, modelNode);
syncBindingProperties(newNode, modelNode, idRenamingHash); syncBindingProperties(newNode, modelNode, idRenamingHash);
syncId(newNode, modelNode, idRenamingHash); syncId(newNode, modelNode, idRenamingHash);
syncNodeProperties(newNode, modelNode, idRenamingHash, view); syncNodeProperties(newNode, modelNode, idRenamingHash, view);
@@ -165,7 +173,6 @@ ModelNode ModelMerger::insertModel(const ModelNode &modelNode)
return newNode; return newNode;
} }
void ModelMerger::replaceModel(const ModelNode &modelNode) void ModelMerger::replaceModel(const ModelNode &modelNode)
{ {
view()->model()->changeImports(modelNode.model()->imports(), {}); view()->model()->changeImports(modelNode.model()->imports(), {});
@@ -182,6 +189,7 @@ void ModelMerger::replaceModel(const ModelNode &modelNode)
QHash<QString, QString> idRenamingHash; QHash<QString, QString> idRenamingHash;
setupIdRenamingHash(modelNode, idRenamingHash, view()); setupIdRenamingHash(modelNode, idRenamingHash, view());
syncAuxiliaryProperties(rootNode, modelNode);
syncVariantProperties(rootNode, modelNode); syncVariantProperties(rootNode, modelNode);
syncBindingProperties(rootNode, modelNode, idRenamingHash); syncBindingProperties(rootNode, modelNode, idRenamingHash);
syncId(rootNode, modelNode, idRenamingHash); syncId(rootNode, modelNode, idRenamingHash);

View File

@@ -42,11 +42,17 @@
#include <qmljs/parser/qmljsengine_p.h> #include <qmljs/parser/qmljsengine_p.h>
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljssimplereader.h>
#include <utils/changeset.h>
#include <utils/qtcassert.h>
using namespace QmlDesigner::Internal; using namespace QmlDesigner::Internal;
namespace QmlDesigner { namespace QmlDesigner {
const char annotationsEscapeSequence[] = "##^##";
RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *parent): RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *parent):
AbstractView(parent), AbstractView(parent),
m_differenceHandling(differenceHandling), m_differenceHandling(differenceHandling),
@@ -442,6 +448,56 @@ void RewriterView::notifyErrorsAndWarnings(const QList<DocumentMessage> &errors)
emitDocumentMessage(errors, m_warnings); 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 Internal::ModelNodePositionStorage *RewriterView::positionStorage() const
{ {
return m_positionStorage.data(); return m_positionStorage.data();
@@ -820,4 +876,108 @@ void RewriterView::delayedSetup()
m_textToModelMerger->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 } //QmlDesigner

View File

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

View File

@@ -279,18 +279,49 @@ void QmlProject::refreshTargetDirectory()
bool QmlProject::supportsKit(const Kit *k, QString *errorMessage) const 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); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version) { if (!version) {
if (errorMessage) if (errorMessage)
*errorMessage = tr("No Qt version set in kit."); *errorMessage = tr("No Qt version set in kit.");
return false; return false;
} }
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0)) { if (version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0)) {
if (errorMessage) if (errorMessage)
*errorMessage = tr("Qt version is too old."); *errorMessage = tr("Qt version is too old.");
return false; 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; return true;
} }
@@ -305,43 +336,10 @@ Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *erro
if (!activeTarget()) { if (!activeTarget()) {
// find a kit that matches prerequisites (prefer default one) // find a kit that matches prerequisites (prefer default one)
QList<Kit*> kits = KitManager::kits( const QList<Kit*> kits = KitManager::kits([this](const Kit *k) { return supportsKit(k, nullptr); });
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;
})
);
if (!kits.isEmpty()) { if (!kits.isEmpty()) {
Kit *kit = 0; Kit *kit = kits.contains(KitManager::defaultKit()) ? KitManager::defaultKit() : kits.first();
if (kits.contains(KitManager::defaultKit()))
kit = KitManager::defaultKit();
else
kit = kits.first();
addTarget(createTarget(kit)); addTarget(createTarget(kit));
} }
} }

View File

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

View File

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

View File

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

View File

@@ -282,91 +282,7 @@ void BaseQtVersion::ctor(const FileName &qmakePath)
void BaseQtVersion::setupExpander() void BaseQtVersion::setupExpander()
{ {
m_expander.setDisplayName( m_expander = createMacroExpander([this]{ return this; });
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(); });
} }
BaseQtVersion::~BaseQtVersion() BaseQtVersion::~BaseQtVersion()
@@ -801,7 +717,7 @@ void BaseQtVersion::setAutoDetectionSource(const QString &autodetectionSource)
QString BaseQtVersion::displayName() const QString BaseQtVersion::displayName() const
{ {
return m_expander.expand(m_unexpandedDisplayName); return m_expander->expand(m_unexpandedDisplayName);
} }
QString BaseQtVersion::unexpandedDisplayName() const QString BaseQtVersion::unexpandedDisplayName() const
@@ -1312,7 +1228,169 @@ QStringList BaseQtVersion::qtConfigValues() const
MacroExpander *BaseQtVersion::macroExpander() 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) void BaseQtVersion::populateQmlFileFinder(FileInProjectFinder *finder, const Target *target)

View File

@@ -232,6 +232,8 @@ public:
QStringList qtConfigValues() const; QStringList qtConfigValues() const;
Utils::MacroExpander *macroExpander() const; // owned by the Qt version 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, static void populateQmlFileFinder(Utils::FileInProjectFinder *finder,
const ProjectExplorer::Target *target); const ProjectExplorer::Target *target);
@@ -315,7 +317,7 @@ private:
mutable QList<ProjectExplorer::Abi> m_qtAbis; 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/environment.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stylehelper.h>
#include <algorithm> #include <algorithm>
@@ -311,7 +312,8 @@ void ExamplesListModel::parseExamples(QXmlStreamReader *reader,
item.projectPath = attributes.value(QLatin1String("projectPath")).toString(); item.projectPath = attributes.value(QLatin1String("projectPath")).toString();
item.hasSourceCode = !item.projectPath.isEmpty(); item.hasSourceCode = !item.projectPath.isEmpty();
item.projectPath = relativeOrInstallPath(item.projectPath, projectsOffset, examplesInstallPath); 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); QPixmapCache::remove(item.imageUrl);
item.docUrl = attributes.value(QLatin1String("docUrl")).toString(); item.docUrl = attributes.value(QLatin1String("docUrl")).toString();
item.isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true"); item.isHighlighted = attributes.value(QLatin1String("isHighlighted")).toString() == QLatin1String("true");

View File

@@ -413,18 +413,16 @@ public:
QRect pixmapRect = inner; QRect pixmapRect = inner;
if (!pm.isNull()) { if (!pm.isNull()) {
painter->setPen(foregroundColor2); painter->setPen(foregroundColor2);
if (item.isVideo) pixmapRect = inner.adjusted(6, 20, -6, -15);
pixmapRect = inner.adjusted(6, 10, -6, -25);
QPoint pixmapPos = pixmapRect.center(); QPoint pixmapPos = pixmapRect.center();
pixmapPos.rx() -= pm.width() / 2; pixmapPos.rx() -= pm.width() / pm.devicePixelRatio() / 2;
pixmapPos.ry() -= pm.height() / 2; pixmapPos.ry() -= pm.height() / pm.devicePixelRatio() / 2;
painter->drawPixmap(pixmapPos, pm); painter->drawPixmap(pixmapPos, pm);
if (item.isVideo) { if (item.isVideo) {
painter->setFont(sizedFont(13, option.widget)); painter->setFont(sizedFont(13, option.widget));
QRect lenRect(x, y + 120, w, 20);
QString videoLen = item.videoLength; QString videoLen = item.videoLength;
lenRect = fm.boundingRect(lenRect, Qt::AlignHCenter, videoLen); painter->drawText(pixmapRect.adjusted(0, 0, 0, painter->font().pixelSize() + 3),
painter->drawText(lenRect.adjusted(0, 0, 5, 0), videoLen); videoLen, Qt::AlignBottom | Qt::AlignHCenter);
} }
} else { } else {
// The description text as fallback. // 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>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Creator - Overview" isVideo="true" videoUrl="https://youtu.be/zAqSiIGdj8M" videoLength="2:06"> <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> <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>
<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"> <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; 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 void QtKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const
{ {
QTC_ASSERT(kit, return); QTC_ASSERT(kit, return);
expander->registerSubProvider( expander->registerSubProvider(QtMacroSubProvider(kit));
[kit]() -> MacroExpander * {
BaseQtVersion *version = qtVersion(kit);
return version ? version->macroExpander() : nullptr;
});
expander->registerVariable("Qt:Name", tr("Name of Qt Version"), expander->registerVariable("Qt:Name", tr("Name of Qt Version"),
[kit]() -> QString { [kit]() -> QString {

View File

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

View File

@@ -2997,6 +2997,14 @@ bool TextEditorWidget::event(QEvent *e)
void TextEditorWidget::inputMethodEvent(QInputMethodEvent *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 (d->m_inBlockSelectionMode) {
if (!e->commitString().isEmpty()) if (!e->commitString().isEmpty())
d->insertIntoBlockSelection(e->commitString()); d->insertIntoBlockSelection(e->commitString());

View File

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

View File

@@ -496,6 +496,37 @@
effect="fill_between_many" effect="fill_between_many"
linkedpaths="#path2259-2-0-6,0" linkedpaths="#path2259-2-0-6,0"
id="path-effect2469-8" /> 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> </defs>
<sodipodi:namedview <sodipodi:namedview
id="base" id="base"
@@ -630,6 +661,79 @@
width="16" width="16"
id="transparentBackgroundRect" id="transparentBackgroundRect"
style="display:inline;fill:none" /> 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 <g
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer6" id="layer6"

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 337 KiB

View File

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

View File

@@ -59,6 +59,7 @@
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <qmljs/qmljsinterpreter.h> #include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljssimplereader.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <QPlainTextEdit> #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); QTEST_MAIN(tst_TestCore);

View File

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