Commit 22212573 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Thomas Hartmann

QmlDesigner: Add list of known global enum scopes

We know that TextInput and TextEdit are enum scopes. Currently
there is no other way (than hardcoding) to identify those scopes, if
they are used for controls (And the actual type is int).

Change-Id: I8eccc54d3b7a90428a71c882364a04e5d1030988
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent dd32d1a1
......@@ -82,6 +82,12 @@ static inline QStringList globalQtEnums()
return list;
}
static inline QStringList knownEnumScopes()
{
static QStringList list = QStringList() << QStringLiteral("TextInput") << QStringLiteral("TextEdit");
return list;
}
static inline bool supportedQtQuickVersion(const QString &version)
{
static QStringList supportedVersions = supportedVersionsList();
......@@ -574,10 +580,16 @@ public:
{
QStringList astValueList = astValue.split(QStringLiteral("."));
if (astValueList.count() == 2 //Check for global Qt enums
&& astValueList.first() == QStringLiteral("Qt")
&& globalQtEnums().contains(astValueList.last()))
return QVariant::fromValue(Enumeration(astValue));
if (astValueList.count() == 2) {
//Check for global Qt enums
if (astValueList.first() == QStringLiteral("Qt")
&& globalQtEnums().contains(astValueList.last()))
return QVariant::fromValue(Enumeration(astValue));
//Check for known enum scopes used globally
if (knownEnumScopes().contains(astValueList.first()))
return QVariant::fromValue(Enumeration(astValue));
}
AST::ExpressionStatement *eStmt = AST::cast<AST::ExpressionStatement *>(rhs);
if (!eStmt || !eStmt->expression)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment