forked from qt-creator/qt-creator
QmlJS: Use QmlJS::toQColor to convert a string to a QColor.
The QColor constructor prints a warning if the string it gets passed isn't a known color name. Also, it doesn't know about the alpha value in strings like "#ff00ff00". Reviewed-by: Thomas Hartmann
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "ui_contextpanewidgetrectangle.h"
|
||||
#include "contextpanewidget.h"
|
||||
#include <qmljs/qmljspropertyreader.h>
|
||||
#include <qmljs/qmljscheck.h>
|
||||
#include <customcolordialog.h>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -79,7 +80,7 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
|
||||
|
||||
if (propertyReader->hasProperty(QLatin1String("color"))) {
|
||||
QString str = propertyReader->readProperty("color").toString();
|
||||
if (QColor(str).alpha() == 0)
|
||||
if (QmlJS::toQColor(str).alpha() == 0)
|
||||
m_none = true;
|
||||
ui->colorColorButton->setColor(str);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user