- QDomNodeList items = titles.item(0).childNodes();
- for (int i = 0;i < items.count();i++) {
- QGraphicsItem *gitem = NULL;
- kDebug() << items.item(i).attributes().namedItem("type").nodeValue();
- int zValue = items.item(i).attributes().namedItem("z-index").nodeValue().toInt();
- if (zValue > -1000)
- if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsTextItem") {
- 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()));
- QGraphicsTextItem *txt = scene->addText(items.item(i).namedItem("content").firstChild().nodeValue(), font);
- txt->setDefaultTextColor(col);
- txt->setTextInteractionFlags(Qt::NoTextInteraction);
- gitem = txt;
+int TitleDocument::loadFromXml(QDomDocument doc, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv) {
+ QDomNodeList titles = doc.elementsByTagName("kdenlivetitle");
+ int maxZValue = 0;
+ if (titles.size()) {
+
+ QDomNodeList items = titles.item(0).childNodes();
+ for (int i = 0;i < items.count();i++) {
+ QGraphicsItem *gitem = NULL;
+ kDebug() << items.item(i).attributes().namedItem("type").nodeValue();
+ int zValue = items.item(i).attributes().namedItem("z-index").nodeValue().toInt();
+ if (zValue > -1000)
+ if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsTextItem") {
+ 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()));
+ QGraphicsTextItem *txt = scene->addText(items.item(i).namedItem("content").firstChild().nodeValue(), font);
+ txt->setDefaultTextColor(col);
+ txt->setTextInteractionFlags(Qt::NoTextInteraction);
+ gitem = txt;
+ } else
+ if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsRectItem") {
+ QString rect = items.item(i).namedItem("content").attributes().namedItem("rect").nodeValue();
+ QString br_str = items.item(i).namedItem("content").attributes().namedItem("brushcolor").nodeValue();
+ QString pen_str = items.item(i).namedItem("content").attributes().namedItem("pencolor").nodeValue();
+ double penwidth = items.item(i).namedItem("content").attributes().namedItem("penwidth").nodeValue().toDouble();
+ QGraphicsRectItem *rec = scene->addRect(stringToRect(rect), QPen(QBrush(stringToColor(pen_str)), penwidth), QBrush(stringToColor(br_str)));
+ gitem = rec;