Fix deprecated use of QColor::setNamedColor
'Use fromString() instead.' Change-Id: I4efef147a8b0486f2664fd7fe6c35a9c82479b90 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
fb0c7a9956
commit
4b8c20a297
@ -122,7 +122,7 @@ static const struct : QMetaTypeModuleHelper
|
||||
return true;
|
||||
);
|
||||
QMETATYPE_CONVERTER(QColor, QByteArray,
|
||||
result.setNamedColor(QLatin1String(source));
|
||||
result = QColor::fromString(QLatin1String(source));
|
||||
return result.isValid();
|
||||
);
|
||||
QMETATYPE_CONVERTER(QString, QColor,
|
||||
@ -131,7 +131,7 @@ static const struct : QMetaTypeModuleHelper
|
||||
return true;
|
||||
);
|
||||
QMETATYPE_CONVERTER(QColor, QString,
|
||||
result.setNamedColor(source);
|
||||
result = QColor::fromString(source);
|
||||
return result.isValid();
|
||||
);
|
||||
#if QT_CONFIG(shortcut)
|
||||
|
@ -2875,7 +2875,7 @@ bool Parser::parseFunction(QString *name, QString *args)
|
||||
|
||||
bool Parser::parseHexColor(QColor *col)
|
||||
{
|
||||
col->setNamedColor(lexem());
|
||||
*col = QColor::fromString(lexem());
|
||||
if (!col->isValid()) {
|
||||
qWarning("QCssParser::parseHexColor: Unknown color name '%s'",lexem().toLatin1().constData());
|
||||
return false;
|
||||
|
@ -1641,7 +1641,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
node->charFormat.setFontFamilies(QStringList(value));
|
||||
}
|
||||
} else if (key == QLatin1String("color")) {
|
||||
QColor c; c.setNamedColor(value);
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setForeground(c);
|
||||
@ -1698,7 +1698,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
case Html_tr:
|
||||
case Html_body:
|
||||
if (key == QLatin1String("bgcolor")) {
|
||||
QColor c; c.setNamedColor(value);
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setBackground(c);
|
||||
@ -1711,7 +1711,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
if (key == QLatin1String("width")) {
|
||||
setWidthAttribute(&node->width, value);
|
||||
} else if (key == QLatin1String("bgcolor")) {
|
||||
QColor c; c.setNamedColor(value);
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setBackground(c);
|
||||
@ -1729,12 +1729,12 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
if (key == QLatin1String("border")) {
|
||||
setFloatAttribute(&node->tableBorder, value);
|
||||
} else if (key == QLatin1String("bgcolor")) {
|
||||
QColor c; c.setNamedColor(value);
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->charFormat.setBackground(c);
|
||||
} else if (key == QLatin1String("bordercolor")) {
|
||||
QColor c; c.setNamedColor(value);
|
||||
QColor c = QColor::fromString(value);
|
||||
if (!c.isValid())
|
||||
qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData());
|
||||
node->borderBrush = c;
|
||||
|
@ -1400,9 +1400,8 @@ void QColorShower::hsvEd()
|
||||
|
||||
void QColorShower::htmlEd()
|
||||
{
|
||||
QColor c;
|
||||
QString t = htEd->text();
|
||||
c.setNamedColor(t);
|
||||
QColor c = QColor::fromString(t);
|
||||
if (!c.isValid())
|
||||
return;
|
||||
curCol = qRgba(c.red(), c.green(), c.blue(), currentAlpha());
|
||||
|
Loading…
x
Reference in New Issue
Block a user