} else {
QTextDocument document;
#ifndef QT_NO_CSSPARSER
- QColor color = p->pen().color();
- document.setDefaultStyleSheet(QString::fromLatin1("body { color: #%1%2%3 }")
- .arg(QString::number(color.red(), 16), 2, QLatin1Char('0'))
- .arg(QString::number(color.green(), 16), 2, QLatin1Char('0'))
- .arg(QString::number(color.blue(), 16), 2, QLatin1Char('0')));
+ const QColor color = p->pen().color();
+ document.setDefaultStyleSheet(QString::fromLatin1("body { color: %1 }")
+ .arg(color.name()));
#endif
document.setDefaultFont(font);
document.setDocumentMargin(0.0);
}
foreach(QGradientStop stop, stops) {
- QString color =
- QString::fromLatin1("#%1%2%3")
- .arg(stop.second.red(), 2, 16, QLatin1Char('0'))
- .arg(stop.second.green(), 2, 16, QLatin1Char('0'))
- .arg(stop.second.blue(), 2, 16, QLatin1Char('0'));
str << QLatin1String(" <stop offset=\"")<< stop.first << QLatin1String("\" ")
- << QLatin1String("stop-color=\"") << color << QLatin1String("\" ")
+ << QLatin1String("stop-color=\"") << stop.second.name() << QLatin1String("\" ")
<< QLatin1String("stop-opacity=\"") << stop.second.alphaF() <<QLatin1String("\" />\n");
}
}