mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-24 03:10:52 +01:00
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:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user