mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Minor : minor change about Xref offset
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4704 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -217,9 +217,9 @@ void CrossRefItem::updateLabel() {
|
|||||||
* Calculate and set position automaticaly.
|
* Calculate and set position automaticaly.
|
||||||
*/
|
*/
|
||||||
void CrossRefItem::autoPos() {
|
void CrossRefItem::autoPos() {
|
||||||
//We calcul the position according to the @snapTo of the xrefproperties
|
//We calcul the position according to the @snapTo of the xrefproperties
|
||||||
if (m_properties.snapTo() == XRefProperties::Bottom)
|
if (m_properties.snapTo() == XRefProperties::Bottom)
|
||||||
centerToBottomDiagram(this, m_element, m_properties.offset());
|
centerToBottomDiagram(this, m_element, m_properties.offset() <= 40 ? 5 : m_properties.offset());
|
||||||
else
|
else
|
||||||
centerToParentBottom(this);
|
centerToParentBottom(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ bool centerToParentBottom(QGraphicsItem *item) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief centerToBottomDiagram
|
* @brief centerToBottomDiagram
|
||||||
* Set item pos to the bottom of diagram and centered vertically to element_to_follow
|
* Set item pos to the bottom of diagram and centered vertically to element_to_follow, and add offset.
|
||||||
* @param item_to_center
|
* @param item_to_center
|
||||||
* @param element_to_follow
|
* @param element_to_follow
|
||||||
|
* @param offset
|
||||||
* @return true if element is centered else false (element_to_follow have not diagram)
|
* @return true if element is centered else false (element_to_follow have not diagram)
|
||||||
*/
|
*/
|
||||||
bool centerToBottomDiagram (QGraphicsItem *item_to_center, Element *element_to_follow, int offset) {
|
bool centerToBottomDiagram (QGraphicsItem *item_to_center, Element *element_to_follow, int offset) {
|
||||||
@@ -57,10 +58,7 @@ bool centerToBottomDiagram (QGraphicsItem *item_to_center, Element *element_to_f
|
|||||||
QRectF border = element_to_follow -> diagram() -> border_and_titleblock.insideBorderRect();
|
QRectF border = element_to_follow -> diagram() -> border_and_titleblock.insideBorderRect();
|
||||||
QPointF point = element_to_follow -> sceneBoundingRect().center();
|
QPointF point = element_to_follow -> sceneBoundingRect().center();
|
||||||
|
|
||||||
if (offset >= 40) //applies offset
|
point.setY(border.bottom() - item_to_center -> boundingRect().height() - offset );
|
||||||
point.setY(border.bottom() - offset );
|
|
||||||
else //applies default
|
|
||||||
point.setY(border.bottom() - item_to_center -> boundingRect().height() - 5);
|
|
||||||
point.rx() -= (item_to_center -> boundingRect().width()/2 +
|
point.rx() -= (item_to_center -> boundingRect().width()/2 +
|
||||||
item_to_center -> boundingRect().left()); //< we add boundingrect.left because this value can be négative
|
item_to_center -> boundingRect().left()); //< we add boundingrect.left because this value can be négative
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ class QGraphicsItem;
|
|||||||
class Element;
|
class Element;
|
||||||
|
|
||||||
bool centerToParentBottom (QGraphicsItem *item);
|
bool centerToParentBottom (QGraphicsItem *item);
|
||||||
bool centerToBottomDiagram (QGraphicsItem *item_to_center, Element *element_to_follow, int offset );
|
bool centerToBottomDiagram (QGraphicsItem *item_to_center, Element *element_to_follow, int offset = 0 );
|
||||||
|
|
||||||
#endif // QGRAPHICSITEMUTILITY_H
|
#endif // QGRAPHICSITEMUTILITY_H
|
||||||
|
|||||||
Reference in New Issue
Block a user