[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Apr 10 13:41:00 UTC 2004
CVS commit by okellogg:
Fix by Piotr Kolaczkowski:
setX(), setY(): Consider width and height for snapping.
M +9 -5 umlwidget.cpp 1.76
--- kdesdk/umbrello/umbrello/umlwidget.cpp #1.75:1.76
@@ -881,12 +881,16 @@ void UMLWidget::setView(UMLView * v) {
void UMLWidget::setX( int x ) {
- if (!m_bIgnoreSnapToGrid)
- x = m_pView->snappedX(x);
+ if (!m_bIgnoreSnapToGrid) {
+ const int halfWidth = width() / 2;
+ x = m_pView->snappedX(x + halfWidth) - halfWidth;
+ }
QCanvasItem::setX( (double)x );
}
void UMLWidget::setY( int y ) {
- if (!m_bIgnoreSnapToGrid)
- y = m_pView->snappedX(y);
+ if (!m_bIgnoreSnapToGrid){
+ const int halfHeight = height() / 2;
+ y = m_pView->snappedX(y + halfHeight) - halfHeight;
+ }
QCanvasItem::setY( (double)y );
}
@@ -1122,7 +1126,7 @@ bool UMLWidget::loadFromXMI( QDomElement
m_bUsesDiagramLineWidth = (bool)usesDiagramLineWidth.toInt();
m_bUsesDiagramUseFillColour = (bool)usesDiagramUseFillColour.toInt();
+ setSize( w.toInt(), h.toInt() );
setX( x.toInt() );
setY( y.toInt() );
- setSize( w.toInt(), h.toInt() );
if (fillColour != "none") {
m_FillColour = QColor(fillColour);
More information about the umbrello-devel
mailing list