diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-18 06:34:18 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-18 06:34:18 (GMT) |
commit | fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf (patch) | |
tree | aa2ba4ce64d047d73c29ab0616e8a89d352c3abd /src/gui/text/qcssparser.cpp | |
parent | d24029e3d4639f1300e7a68858936911df969f69 (diff) | |
parent | 572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (diff) | |
download | Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.zip Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.gz Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.bz2 |
Merge commit 'qt/master'
Conflicts:
doc/src/examples.qdoc
doc/src/plugins-howto.qdoc
doc/src/topics.qdoc
examples/phonon/musicplayer/mainwindow.cpp
src/3rdparty/freetype/src/base/ftobjs.c
src/corelib/global/qglobal.h
src/corelib/tools/qalgorithms.h
src/corelib/tools/qshareddata.cpp
src/corelib/tools/qsharedpointer.cpp
src/corelib/tools/tools.pri
src/corelib/xml/qxmlstream.h
src/gui/painting/painting.pri
src/gui/widgets/qdatetimeedit.cpp
tests/auto/qdesktopservices/qdesktopservices.pro
tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
tests/auto/qtextcodec/test/test.pro
Diffstat (limited to 'src/gui/text/qcssparser.cpp')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 7f9cd9d..fcc26d6 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -383,10 +383,7 @@ LengthData ValueExtractor::lengthValue(const Value& v) if (data.unit != LengthData::None) s.chop(2); - bool ok; - data.number = s.toDouble(&ok); - if (!ok) - data.number = 0; + data.number = s.toDouble(); return data; } @@ -712,7 +709,7 @@ static ColorData parseColorValue(Value v) for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) { if (colorDigits.at(i).type == Value::Percentage) { - colorDigits[i].variant = colorDigits.at(i).variant.toDouble() * 255. / 100.; + colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); colorDigits[i].type = Value::Number; } else if (colorDigits.at(i).type != Value::Number) { return ColorData(); @@ -789,19 +786,19 @@ static BrushData parseBrushValue(const Value &v, const QPalette &pal) ColorData cd = parseColorValue(color); if(cd.type == ColorData::Role) dependsOnThePalette = true; - stops.append(QGradientStop(stop.variant.toDouble(), colorFromData(cd, pal))); + stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal))); } else { parser.next(); Value value; - parser.parseTerm(&value); + (void)parser.parseTerm(&value); if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) { spread = spreads.indexOf(value.variant.toString()); } else { - vars[attr] = value.variant.toString().toDouble(); + vars[attr] = value.variant.toReal(); } } parser.skipSpace(); - parser.test(COMMA); + (void)parser.test(COMMA); } if (gradType == 0) { @@ -1080,8 +1077,8 @@ static bool setFontSizeFromValue(Value value, QFont *font, int *fontSizeAdjustme if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)) { s.chop(2); value.variant = s; - if (value.variant.convert(QVariant::Double)) { - font->setPointSizeF(value.variant.toDouble()); + if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) { + font->setPointSizeF(value.variant.toReal()); valid = true; } } else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) { @@ -2462,7 +2459,7 @@ bool Parser::parseAttrib(AttributeSelector *attr) bool Parser::parsePseudo(Pseudo *pseudo) { - test(COLON); + (void)test(COLON); pseudo->negated = test(EXCLAMATION_SYM); if (test(IDENT)) { pseudo->name = lexem(); |