diff options
author | Erik Verbruggen <[email protected]> | 2010-03-01 13:01:05 +0100 |
---|---|---|
committer | Erik Verbruggen <[email protected]> | 2010-03-01 13:13:02 +0100 |
commit | 13d7612f0956e086f358c13770b3421c7593e191 (patch) | |
tree | 929189d22982da1a9cbdbd1bd66cd3091d9718fc /src/libs/qmljs/qmljscheck.cpp | |
parent | 079897f2958f6c0548ba38d28968ea086c30fd37 (diff) |
Removed private header dependencies and introduced loading QML types from XML file.
Diffstat (limited to 'src/libs/qmljs/qmljscheck.cpp')
-rw-r--r-- | src/libs/qmljs/qmljscheck.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index ab9e336719a..b866ab3ac4d 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -38,10 +38,6 @@ #include <QtGui/QColor> #include <QtGui/QApplication> -#ifndef NO_DECLARATIVE_BACKEND -# include <QtDeclarative/private/qdeclarativestringconverters_p.h> // ### remove me -#endif - namespace QmlJS { namespace Messages { static const char *invalid_property_name = QT_TRANSLATE_NOOP("QmlJS::Check", "'%1' is not a valid property name"); @@ -122,7 +118,6 @@ public: if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) { const QString curveName = stringLiteral->value->asString(); - // ### update when easing changes hit master if (!EasingCurveNameValue::curveNames().contains(curveName)) { _message.message = tr(Messages::unknown_easing_curve_name); } @@ -139,12 +134,23 @@ public: if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) { const QString colorString = stringLiteral->value->asString(); -#ifndef NO_DECLARATIVE_BACKEND - bool ok = false; - QDeclarativeStringConverters::colorFromString(colorString, &ok); + bool ok = true; + if (colorString.size() == 9 && colorString.at(0) == QLatin1Char('#')) { + // #rgba + for (int i = 1; i < 9; ++i) { + const QChar c = colorString.at(i); + if (c >= QLatin1Char('0') && c <= QLatin1Char('9') + || c >= QLatin1Char('a') && c <= QLatin1Char('f') + || c >= QLatin1Char('A') && c <= QLatin1Char('F')) + continue; + ok = false; + break; + } + } else { + ok = QColor(colorString).isValid(); + } if (!ok) _message.message = QCoreApplication::translate("QmlJS::Check", "not a valid color"); -#endif } else { visit((StringValue *)0); } |