[qet] [4704] Minor : minor change about Xref offset |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4704
Author: blacksun
Date: 2016-09-13 18:32:02 +0200 (Tue, 13 Sep 2016)
Log Message:
-----------
Minor : minor change about Xref offset
Modified Paths:
--------------
trunk/sources/qetgraphicsitem/crossrefitem.cpp
trunk/sources/qetgraphicsitem/qgraphicsitemutility.cpp
trunk/sources/qetgraphicsitem/qgraphicsitemutility.h
Modified: trunk/sources/qetgraphicsitem/crossrefitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/crossrefitem.cpp 2016-09-13 14:55:40 UTC (rev 4703)
+++ trunk/sources/qetgraphicsitem/crossrefitem.cpp 2016-09-13 16:32:02 UTC (rev 4704)
@@ -217,9 +217,9 @@
* Calculate and set position automaticaly.
*/
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)
- centerToBottomDiagram(this, m_element, m_properties.offset());
+ centerToBottomDiagram(this, m_element, m_properties.offset() <= 40 ? 5 : m_properties.offset());
else
centerToParentBottom(this);
}
Modified: trunk/sources/qetgraphicsitem/qgraphicsitemutility.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/qgraphicsitemutility.cpp 2016-09-13 14:55:40 UTC (rev 4703)
+++ trunk/sources/qetgraphicsitem/qgraphicsitemutility.cpp 2016-09-13 16:32:02 UTC (rev 4704)
@@ -43,9 +43,10 @@
/**
* @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 element_to_follow
+ * @param offset
* @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) {
@@ -57,10 +58,7 @@
QRectF border = element_to_follow -> diagram() -> border_and_titleblock.insideBorderRect();
QPointF point = element_to_follow -> sceneBoundingRect().center();
- if (offset >= 40) //applies offset
- point.setY(border.bottom() - offset );
- else //applies default
- point.setY(border.bottom() - item_to_center -> boundingRect().height() - 5);
+ point.setY(border.bottom() - item_to_center -> boundingRect().height() - offset );
point.rx() -= (item_to_center -> boundingRect().width()/2 +
item_to_center -> boundingRect().left()); //< we add boundingrect.left because this value can be négative
Modified: trunk/sources/qetgraphicsitem/qgraphicsitemutility.h
===================================================================
--- trunk/sources/qetgraphicsitem/qgraphicsitemutility.h 2016-09-13 14:55:40 UTC (rev 4703)
+++ trunk/sources/qetgraphicsitem/qgraphicsitemutility.h 2016-09-13 16:32:02 UTC (rev 4704)
@@ -22,6 +22,6 @@
class Element;
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