mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-22 12:39:59 +01:00
Fix the left margin of the diagram : In some condition, (most of time when use copy and paste) a margin appear in the left of the folio.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5004 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -137,7 +137,42 @@ void ConductorTextItem::forceRotateByUser(bool rotate_by_user) {
|
||||
rotate_by_user_ = rotate_by_user;
|
||||
if (!rotate_by_user && parent_conductor_) {
|
||||
parent_conductor_ -> calculateTextItemPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorTextItem::setPos
|
||||
* @param pos
|
||||
*/
|
||||
void ConductorTextItem::setPos(const QPointF &pos)
|
||||
{
|
||||
/*
|
||||
* In some condition the conductor text item is outside the border of folio in the left.
|
||||
* They cause a margin on the left of folio and in most case this margin is unwanted and annoying the user.
|
||||
* If the text is empty and the scene position is outside the border (left and top),
|
||||
* we can say that this position, is unwanted by user.
|
||||
* So we move this text item to the top left of the bounding rect of parent conductors, because we sure this position is wanted by user.
|
||||
*/
|
||||
DiagramTextItem::setPos(pos);
|
||||
if(toPlainText().isEmpty() && (scenePos().x() < 0 || scenePos().y() < 0))
|
||||
{
|
||||
Conductor *cond = parentConductor();
|
||||
if(cond)
|
||||
DiagramTextItem::setPos(cond->boundingRect().topLeft());
|
||||
else
|
||||
DiagramTextItem::setPos(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorTextItem::setPos
|
||||
* @param x
|
||||
* @param y
|
||||
*/
|
||||
void ConductorTextItem::setPos(qreal x, qreal y)
|
||||
{
|
||||
QPointF p(x,y);
|
||||
setPos(p);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,5 +273,5 @@ void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
||||
*/
|
||||
void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e) {
|
||||
Q_UNUSED(e);
|
||||
QGraphicsTextItem::hoverMoveEvent(e);
|
||||
QGraphicsTextItem::hoverMoveEvent(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user