Diagram editor : add 4 tools for edit the depth (Z value) of items.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5394 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-06-17 18:21:56 +00:00
parent 74ac93e171
commit 52eb4b5f71
11 changed files with 209 additions and 79 deletions

View File

@@ -44,6 +44,12 @@ QetShapeItem::QetShapeItem(QPointF p1, QPointF p2, ShapeType type, QGraphicsItem
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges);
setAcceptHoverEvents(true);
m_pen.setStyle(Qt::DashLine);
//ensure handlers are always above this item
connect(this, &QetShapeItem::zChanged, [this]()
{
for(QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setZValue(this->zValue()+1);
});
}
@@ -356,6 +362,7 @@ QVariant QetShapeItem::itemChange(QGraphicsItem::GraphicsItemChange change, cons
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
handler->setZValue(this->zValue()+1);
handler->setColor(Qt::blue);
scene()->addItem(handler);
handler->installSceneEventFilter(this);
@@ -614,6 +621,7 @@ bool QetShapeItem::fromXml(const QDomElement &e)
else
foreach(QDomElement de, QET::findInDomElement(e, "points", "point"))
m_polygon << QPointF(de.attribute("x", nullptr).toDouble(), de.attribute("y", nullptr).toDouble());
setZValue(e.attribute("z", QString::number(this->zValue())).toDouble());
return (true);
}
@@ -656,6 +664,7 @@ QDomElement QetShapeItem::toXml(QDomDocument &document) const
}
result.appendChild(points);
}
result.setAttribute("z", QString::number(this->zValue()));
return(result);
}