]> git.sesse.net Git - kdenlive/blobdiff - src/titledocument.cpp
* New config option for preview: disable B Frame decoding on h.264:
[kdenlive] / src / titledocument.cpp
index 000ab0ac1d50ea23cd2831858b4dbe2033e8e0e7..e517999a65411fddfd2fdbf58d137bd6401c0268 100644 (file)
@@ -113,20 +113,29 @@ QDomDocument TitleDocument::xml(QGraphicsPolygonItem* startv, QGraphicsPolygonIt
         main.appendChild(endp);
     }
     QDomElement backgr = doc.createElement("background");
-    QList<QGraphicsItem *> items = scene->items();
-    QColor color(0, 0, 0, 0);
-    for (int i = 0; i < items.size(); i++) {
-        if (items.at(i)->zValue() == -1100) {
-            color = ((QGraphicsRectItem *)items.at(i))->brush().color();
-            break;
-        }
-    }
+    QColor color = getBackgroundColor();
     backgr.setAttribute("color", colorToString(color));
     main.appendChild(backgr);
 
     return doc;
 }
 
+/** \brief Get the background color (incl. alpha) from the document, if possibly
+  * \returns The background color of the document, inclusive alpha. If none found, returns (0,0,0,0) */
+QColor TitleDocument::getBackgroundColor() {
+    QColor color(0, 0, 0, 0);
+    if (scene) {
+        QList<QGraphicsItem *> items = scene->items();
+        for (int i = 0; i < items.size(); i++) {
+            if (items.at(i)->zValue() == -1100) {
+                color = ((QGraphicsRectItem *)items.at(i))->brush().color();
+                return color;
+            }
+        }
+    }
+    return color;
+}
+
 
 bool TitleDocument::saveDocument(const KUrl& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv) {
     if (!scene)