summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qcssparser.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2019-12-02 17:54:48 +0100
committerOlivier Goffart <ogoffart@woboq.com>2020-01-23 16:46:51 +0100
commit73d1476fb1397948a4d806bd921fce372bd8d63b (patch)
treea476349c26627027d78c1279da00ef633323311f /src/gui/text/qcssparser.cpp
parenta78d66743171557d79b16c08be775e3ac15bb4ef (diff)
Replace most use of QVariant::type and occurrences of QVariant::Type
I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qcssparser.cpp')
-rw-r--r--src/gui/text/qcssparser.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index c0b0071e4d..a12eb98528 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -707,7 +707,7 @@ static Qt::Alignment parseAlignment(const QCss::Value *values, int count)
static ColorData parseColorValue(QCss::Value v)
{
if (v.type == Value::Identifier || v.type == Value::String) {
- v.variant.convert(QVariant::Color);
+ v.variant.convert(QMetaType::QColor);
v.type = Value::Color;
}
@@ -1143,7 +1143,7 @@ static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAd
} else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
s.chop(2);
value.variant = s;
- if (value.variant.convert(QVariant::Int)) {
+ if (value.variant.convert(QMetaType::Int)) {
font->setPixelSize(value.variant.toInt());
valid = true;
}
@@ -1420,9 +1420,9 @@ QColor Declaration::colorValue(const QPalette &pal) const
return QColor();
if (d->parsed.isValid()) {
- if (d->parsed.type() == QVariant::Color)
+ if (d->parsed.userType() == QMetaType::QColor)
return qvariant_cast<QColor>(d->parsed);
- if (d->parsed.type() == QVariant::Int)
+ if (d->parsed.userType() == QMetaType::Int)
return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
}
@@ -1442,9 +1442,9 @@ QBrush Declaration::brushValue(const QPalette &pal) const
return QBrush();
if (d->parsed.isValid()) {
- if (d->parsed.type() == QVariant::Brush)
+ if (d->parsed.userType() == QMetaType::QBrush)
return qvariant_cast<QBrush>(d->parsed);
- if (d->parsed.type() == QVariant::Int)
+ if (d->parsed.userType() == QMetaType::Int)
return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
}
@@ -1469,9 +1469,9 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const
needParse = 0;
QList<QVariant> v = d->parsed.toList();
for (i = 0; i < qMin(v.count(), 4); i++) {
- if (v.at(i).type() == QVariant::Brush) {
+ if (v.at(i).userType() == QMetaType::QBrush) {
c[i] = qvariant_cast<QBrush>(v.at(i));
- } else if (v.at(i).type() == QVariant::Int) {
+ } else if (v.at(i).userType() == QMetaType::Int) {
c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
} else {
needParse |= (1<<i);
@@ -1598,7 +1598,7 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const
if (d->parsed.isValid()) {
QList<QVariant> v = d->parsed.toList();
for (i = 0; i < qMin(d->values.count(), 4); i++) {
- if (v.at(i).type() == QVariant::Color) {
+ if (v.at(i).userType() == QMetaType::QColor) {
c[i] = qvariant_cast<QColor>(v.at(i));
} else {
c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
@@ -2723,7 +2723,7 @@ bool Parser::parseTerm(Value *value)
switch (lookup()) {
case NUMBER:
value->type = Value::Number;
- value->variant.convert(QVariant::Double);
+ value->variant.convert(QMetaType::Double);
break;
case PERCENTAGE:
value->type = Value::Percentage;