content.setAttribute("font-pixel-size", font.pixelSize());
content.setAttribute("font-italic", font.italic());
content.setAttribute("font-underline", font.underline());
- content.setAttribute("font-color", colorToString(t->defaultTextColor()));
-
+ {
+ QTextCursor cursor(t->document());
+ cursor.select(QTextCursor::Document);
+ QColor fontcolor = cursor.charFormat().foreground().color();
+ content.setAttribute("font-color", colorToString(fontcolor));
+ if (!t->data(101).isNull()) content.setAttribute("font-outline", t->data(101).toDouble());
+ if (!t->data(102).isNull()) content.setAttribute("font-outline-color", colorToString(QColor(t->data(102).toString())));
+ }
if (!t->data(100).isNull()) {
QStringList effectParams = t->data(100).toStringList();
- content.setAttribute(effectParams.takeFirst(), effectParams.join(";"));
+ QString effectName = effectParams.takeFirst();
+ content.setAttribute(effectName, effectParams.join(";"));
}
// Only save when necessary.
font.setPixelSize(txtProperties.namedItem("font-pixel-size").nodeValue().toInt());
QColor col(stringToColor(txtProperties.namedItem("font-color").nodeValue()));
QGraphicsTextItem *txt = m_scene->addText(items.item(i).namedItem("content").firstChild().nodeValue(), font);
- txt->setDefaultTextColor(col);
+ QTextCursor cursor(txt->document());
+ cursor.select(QTextCursor::Document);
+ QTextCharFormat format;
+ if (txtProperties.namedItem("font-outline").nodeValue().toDouble() > 0.0) {
+ txt->setData(101, txtProperties.namedItem("font-outline").nodeValue().toDouble());
+ txt->setData(102, stringToColor(txtProperties.namedItem("font-outline-color").nodeValue()));
+ format.setTextOutline(
+ QPen(QColor(stringToColor(txtProperties.namedItem("font-outline-color").nodeValue())),
+ txtProperties.namedItem("font-outline").nodeValue().toDouble())
+ );
+
+ }
+ format.setForeground(QBrush(col));
+ cursor.mergeCharFormat(format);
txt->setTextInteractionFlags(Qt::NoTextInteraction);
if (txtProperties.namedItem("alignment").isNull() == false) {
txt->setTextWidth(txt->boundingRect().width());