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)
int loadDocument(const KUrl& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv);
QDomDocument xml(QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv);
int loadFromXml(QDomDocument doc, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv);
+ /** \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 getBackgroundColor();
private:
QString colorToString(const QColor&);
void TitleWidget::slotNewText(QGraphicsTextItem *tt) {
QFont font = font_family->currentFont();
font.setPointSize(font_size->value());
+ // mbd: issue 551:
+ font.setBold(buttonBold->isChecked());
+ font.setItalic(buttonItalic->isChecked());
+ font.setUnderline(buttonUnder->isChecked());
+
tt->setFont(font);
QColor color = fontColorButton->color();
color.setAlpha(textAlpha->value());
void TitleWidget::setXml(QDomDocument doc) {
m_count = m_titledocument.loadFromXml(doc, startViewport, endViewport);
+ // mbd: Update the GUI color selectors to match the stuff from the loaded document
+ QColor background_color = m_titledocument.getBackgroundColor();
+ horizontalSlider->blockSignals(true);
+ kcolorbutton->blockSignals(true);
+ horizontalSlider->setValue(background_color.alpha());
+ background_color.setAlpha(255);
+ kcolorbutton->setColor(background_color);
+ horizontalSlider->blockSignals(false);
+ kcolorbutton->blockSignals(false);
+
slotSelectTool();
}