Improvement : minimize the unwanted gap of the top right folio of the view

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5819 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2019-04-02 17:36:32 +00:00
parent 885e61f438
commit 4bbf086a88

View File

@@ -124,13 +124,21 @@ void ElementsMover::continueMovement(const QPointF &movement) {
}
// Move some conductors
foreach(Conductor *conductor, m_moved_content.m_conductors_to_move) {
conductor -> setPos(conductor -> pos() + movement);
}
// Recalcul the path of other conductors
foreach(Conductor *conductor, m_moved_content.m_conductors_to_update) {
conductor -> updatePath();
QList<Conductor *> c_list;
c_list.append(m_moved_content.m_conductors_to_move);
c_list.append(m_moved_content.m_conductors_to_update);
for (Conductor *c : c_list)
{
//Due to a weird behavior, we must to ensure that the position of the conductor is to (0,0).
//If not, in some unknown case the function QGraphicsScene::itemsBoundingRect() return a rectangle
//that take in acount the pos() of the conductor, even if the bounding rect returned by the conductor is not in the pos().
//For the user this situation appear when the top right of the folio is not at the top right of the graphicsview,
//but displaced to the right and/or bottom.
if (c->pos() != QPointF(0,0)) {
c->setPos(0,0);
}
c->updatePath();
}
}