forked from qt-creator/qt-creator
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: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
dd32d1a16e
commit
2221257306
@@ -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)
|
||||
|
Reference in New Issue
Block a user