Diagram editor : add a new widget in the "curent selection dock" for edit the independent text. WIP

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5737 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2019-02-19 16:42:07 +00:00
parent 2300314bf5
commit 33d757e0d8
12 changed files with 533 additions and 74 deletions

View File

@@ -17,6 +17,8 @@
*/
#include "independenttextitem.h"
#include "qet.h"
#include "diagram.h"
#include "diagramcommands.h"
#include <QDomElement>
/**
@@ -56,13 +58,21 @@ void IndependentTextItem::fromXml(const QDomElement &e) {
@param document Le document XML a utiliser
@return L'element XML representant ce champ de texte
*/
QDomElement IndependentTextItem::toXml(QDomDocument &document) const {
QDomElement IndependentTextItem::toXml(QDomDocument &document) const
{
QDomElement result = document.createElement("input");
result.setAttribute("x", QString("%1").arg(pos().x()));
result.setAttribute("y", QString("%1").arg(pos().y()));
result.setAttribute("text", toHtml());
if (rotation()) {
result.setAttribute("rotation", QString::number(QET::correctAngle(rotation())));
}
result.setAttribute("rotation", QString::number(QET::correctAngle(rotation())));
return(result);
}
void IndependentTextItem::focusOutEvent(QFocusEvent *event)
{
DiagramTextItem::focusOutEvent(event);
if (diagram() && (m_previous_html_text != this->toHtml())) {
diagram()->undoStack().push(new ChangeDiagramTextCommand(this, m_previous_html_text, this->toHtml()));
}
}