[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [umbrello/_associationline_refactoring_] umbrello/widgets: Small fixes and debug info added.
From:       Andi Fischer <andi.fischer () hispeed ! ch>
Date:       2013-07-30 17:51:59
Message-ID: E1V4E5X-0003sB-DT () scm ! kde ! org
[Download RAW message or body]

Git commit c77c2ccc2ed49804c4299a260370586136dc07d5 by Andi Fischer.
Committed on 30/07/2013 at 17:51.
Pushed by fischer into branch '_associationline_refactoring_'.

Small fixes and debug info added.

M  +4    -6    umbrello/widgets/associationline.cpp
M  +2    -2    umbrello/widgets/associationwidget.cpp
M  +1    -1    umbrello/widgets/associationwidget.h

http://commits.kde.org/umbrello/c77c2ccc2ed49804c4299a260370586136dc07d5

diff --git a/umbrello/widgets/associationline.cpp b/umbrello/widgets/associationline.cpp
index be8d2d2..c8e3216 100644
--- a/umbrello/widgets/associationline.cpp
+++ b/umbrello/widgets/associationline.cpp
@@ -75,7 +75,6 @@ QPointF AssociationLine::point(int index) const
 {
     if ((index < 0) | (index > m_points.size() - 1)) {
         uWarning() << "Index " << index << " out of range [0.." << m_points.size() - 1 << "].";
-        //:TODO: Q_ASSERT(index >= 0 && index < m_points.size() - 1);
         return QPointF(-1.0, -1.0);
     }
     return m_points.at(index);
@@ -712,7 +711,6 @@ void AssociationLine::reconstructSymbols()
         default:
             break;
     }
-
     alignSymbols();
 }
 
@@ -845,7 +843,6 @@ void AssociationLine::alignSymbols()
     }
 
     if (m_collaborationLineItem) {
-        Q_ASSERT(m_collaborationLineHead != 0);
         const qreal distance = 10;
         const int midSegmentIndex = (sz - 1) / 2;
 
@@ -975,11 +972,13 @@ QPainterPath AssociationLine::createOrthogonalPath(QVector<QPointF> points)
         QPointF end    = points.last();
         qreal deltaX = abs(start.x() - end.x());
         qreal deltaY = abs(start.y() - end.y());
+        DEBUG("AssociationLine") << "start=" << start << " / end=" << end
+                       << " / deltaX=" << deltaX << " / deltaY=" << deltaY;
         QVector<QPointF> vector;
         for (int i = 0; i < points.size() - 1; ++i) {
             QPointF curr = points.at(i);
             QPointF next = points.at(i+1);
-            QPointF center = (next - curr)/2.0;
+            QPointF center = (next + curr)/2.0;
 
             vector.append(curr);
             if (deltaX < deltaY) {
@@ -1043,14 +1042,13 @@ void AssociationLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* o
         m_points[sz - 1] = newEnd;
     }
 
-    QPen _pen = pen();
-
     painter->setPen(_pen);
     painter->setBrush(Qt::NoBrush);
     painter->drawPath(shape());
 
     if (option->state & QStyle::State_Selected) {
         // set color for selected painting
+//:TODO:
 //        const QColor orig = _pen.color().lighter();
 //        QColor invertedColor(orig.green(), orig.blue(), orig.red());
 //        if (invertedColor == _pen.color()) {
diff --git a/umbrello/widgets/associationwidget.cpp b/umbrello/widgets/associationwidget.cpp
index 2626c77..6b39988 100644
--- a/umbrello/widgets/associationwidget.cpp
+++ b/umbrello/widgets/associationwidget.cpp
@@ -1908,8 +1908,8 @@ void AssociationWidget::widgetMoved(UMLWidget* widget, int x, int y )
 
     int dx = m_role[RoleType::A].umlWidget->x() - x;
     int dy = m_role[RoleType::A].umlWidget->y() - y;
-    uint size = m_associationLine->count();
-    uint pos = size - 1;
+    int size = m_associationLine->count();
+    int pos = size - 1;
     if (associationType() == AssociationType::Exception) {
         updatePointsException();
         setTextPosition( TextRole::Name );
diff --git a/umbrello/widgets/associationwidget.h b/umbrello/widgets/associationwidget.h
index 526812f..b77292c 100644
--- a/umbrello/widgets/associationwidget.h
+++ b/umbrello/widgets/associationwidget.h
@@ -306,7 +306,7 @@ private:
      * This segment is:
      * m_associationLine[m_unNameLineSegment] -- m_associationLine[m_unNameLineSegment+1]
      */
-    uint                m_unNameLineSegment;
+    int                 m_unNameLineSegment;
     bool                m_selected;
     int                 m_nMovingPoint;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic