forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.2'
Conflicts: src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp Change-Id: I1627f6aa98a442413f8b08b579ecaf9647dc887b
This commit is contained in:
@@ -525,10 +525,24 @@ public:
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class UnsupportedRootObjectTypesByVisualDesigner : public QStringList
|
||||
{
|
||||
public:
|
||||
UnsupportedRootObjectTypesByVisualDesigner()
|
||||
{
|
||||
(*this) << QLatin1String("QtObject") << QLatin1String("ListModel")
|
||||
<< QLatin1String("Component") << QLatin1String("Timer")
|
||||
<< QLatin1String("Package");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
Q_GLOBAL_STATIC(VisualAspectsPropertyBlackList, visualAspectsPropertyBlackList)
|
||||
Q_GLOBAL_STATIC(UnsupportedTypesByVisualDesigner, unsupportedTypesByVisualDesigner)
|
||||
Q_GLOBAL_STATIC(UnsupportedRootObjectTypesByVisualDesigner, unsupportedRootObjectTypesByVisualDesigner)
|
||||
|
||||
Check::Check(Document::Ptr doc, const ContextPtr &context)
|
||||
: _doc(doc)
|
||||
@@ -559,6 +573,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
|
||||
disableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner);
|
||||
disableMessage(WarnUndefinedValueForVisualDesigner);
|
||||
disableMessage(WarnStatesOnlyInRootItemForVisualDesigner);
|
||||
disableMessage(ErrUnsupportedRootTypeInVisualDesigner);
|
||||
}
|
||||
|
||||
Check::~Check()
|
||||
@@ -729,6 +744,13 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
|
||||
if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State"))
|
||||
addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation);
|
||||
|
||||
const QString typeName = getRightMostIdentifier(typeId)->name.toString();
|
||||
|
||||
if (m_typeStack.isEmpty()
|
||||
&& unsupportedRootObjectTypesByVisualDesigner()->contains(typeName))
|
||||
addMessage(ErrUnsupportedRootTypeInVisualDesigner,
|
||||
locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()), typeName);
|
||||
|
||||
bool typeError = false;
|
||||
if (_importsOk) {
|
||||
const ObjectValue *prototype = _context->lookupType(_doc.data(), typeId);
|
||||
|
||||
@@ -1361,6 +1361,8 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
|
||||
res.maybeAddPath(pAndL.path().toString());
|
||||
}
|
||||
}
|
||||
foreach (const QString &path, environmentImportPaths())
|
||||
res.maybeAddPath(path);
|
||||
break;
|
||||
}
|
||||
case Dialect::NoLanguage:
|
||||
@@ -1385,6 +1387,11 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
|
||||
if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
|
||||
|| res.language == Dialect::QmlQtQuick1)
|
||||
res.maybeAddPath(info.qtQmlPath);
|
||||
if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
|
||||
|| res.language == Dialect::QmlQtQuick1 || res.language == Dialect::QmlQtQuick2) {
|
||||
foreach (const QString &path, environmentImportPaths())
|
||||
res.maybeAddPath(path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
res.flags = ViewerContext::Complete;
|
||||
|
||||
@@ -221,6 +221,8 @@ StaticAnalysisMessages::StaticAnalysisMessages()
|
||||
tr("Qt Quick Designer only supports states in the root item."));
|
||||
newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning,
|
||||
tr("Using Qt Quick 1 code model instead of Qt Quick 2."));
|
||||
newMsg(ErrUnsupportedRootTypeInVisualDesigner, Error,
|
||||
tr("This type is not supported as a root element by Qt Quick Designer %1."), 1);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@@ -97,6 +97,7 @@ enum Type
|
||||
WarnReferenceToParentItemNotSupportedByVisualDesigner = 205,
|
||||
WarnUndefinedValueForVisualDesigner = 206,
|
||||
WarnStatesOnlyInRootItemForVisualDesigner = 207,
|
||||
ErrUnsupportedRootTypeInVisualDesigner = 208,
|
||||
ErrUnknownComponent = 300,
|
||||
ErrCouldNotResolvePrototypeOf = 301,
|
||||
ErrCouldNotResolvePrototype = 302,
|
||||
|
||||
Reference in New Issue
Block a user