- QFont font(items.item(i).namedItem("content").attributes().namedItem("font").nodeValue());
- font.setBold(items.item(i).namedItem("content").attributes().namedItem("font-bold").nodeValue().toInt());
- font.setItalic(items.item(i).namedItem("content").attributes().namedItem("font-italic").nodeValue().toInt());
- font.setUnderline(items.item(i).namedItem("content").attributes().namedItem("font-underline").nodeValue().toInt());
- font.setPointSize(items.item(i).namedItem("content").attributes().namedItem("font-size").nodeValue().toInt());
- QColor col(stringToColor(items.item(i).namedItem("content").attributes().namedItem("font-color").nodeValue()));
+ QDomNamedNodeMap txtProperties = items.item(i).namedItem("content").attributes();
+ QFont font(txtProperties.namedItem("font").nodeValue());
+ font.setBold(txtProperties.namedItem("font-bold").nodeValue().toInt());
+ font.setItalic(txtProperties.namedItem("font-italic").nodeValue().toInt());
+ font.setUnderline(txtProperties.namedItem("font-underline").nodeValue().toInt());
+ // Older Kdenlive version did not store pixel size but point size
+ if (txtProperties.namedItem("font-pixel-size").isNull()) {
+ QFont f2;
+ f2.setPointSize(txtProperties.namedItem("font-size").nodeValue().toInt());
+ font.setPixelSize(QFontInfo(f2).pixelSize());
+ }
+ else font.setPixelSize(txtProperties.namedItem("font-pixel-size").nodeValue().toInt());
+ QColor col(stringToColor(txtProperties.namedItem("font-color").nodeValue()));