Element editor: removed the "circle" tool because it was incompatible with non 1:1 scaling operations.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2039 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2013-02-11 21:45:51 +00:00
parent cf063e0a6c
commit d36820ca2b
9 changed files with 19 additions and 543 deletions

View File

@@ -66,12 +66,18 @@ void PartEllipse::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
@return un element XML decrivant l'ellipse
*/
const QDomElement PartEllipse::toXml(QDomDocument &xml_document) const {
QDomElement xml_element = xml_document.createElement("ellipse");
QDomElement xml_element;
if (qFuzzyCompare(rect().width(), rect().height())) {
xml_element = xml_document.createElement("circle");
xml_element.setAttribute("diameter", QString("%1").arg(rect().width()));
} else {
xml_element = xml_document.createElement("ellipse");
xml_element.setAttribute("width", QString("%1").arg(rect().width()));
xml_element.setAttribute("height", QString("%1").arg(rect().height()));
}
QPointF top_left(sceneTopLeft());
xml_element.setAttribute("x", QString("%1").arg(top_left.x()));
xml_element.setAttribute("y", QString("%1").arg(top_left.y()));
xml_element.setAttribute("width", QString("%1").arg(rect().width()));
xml_element.setAttribute("height", QString("%1").arg(rect().height()));
stylesToXml(xml_element);
return(xml_element);
}
@@ -82,16 +88,20 @@ const QDomElement PartEllipse::toXml(QDomDocument &xml_document) const {
*/
void PartEllipse::fromXml(const QDomElement &qde) {
stylesFromXml(qde);
qreal width, height;
if (qde.tagName() == "ellipse") {
width = qde.attribute("width", "0").toDouble();
height = qde.attribute("height", "0").toDouble();
} else {
width = height = qde.attribute("diameter", "0").toDouble();
}
setRect(
QRectF(
mapFromScene(
qde.attribute("x", "0").toDouble(),
qde.attribute("y", "0").toDouble()
),
QSizeF(
qde.attribute("width", "0").toDouble(),
qde.attribute("height", "0").toDouble()
)
QSizeF(width, height)
)
);
}