[Uml-devel] KDE/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat May 7 15:41:01 UTC 2005


SVN commit 410429 by okellogg:

Umbrello::decoratePoint(): New, factored out from LinePath code.


 M  +3 -9      trunk/KDE/kdesdk/umbrello/umbrello/linepath.cpp  
 M  +18 -0     trunk/KDE/kdesdk/umbrello/umbrello/widget_utils.cpp  
 M  +6 -1      trunk/KDE/kdesdk/umbrello/umbrello/widget_utils.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/linepath.cpp #410428:410429
@@ -25,6 +25,7 @@
 // application includes
 #include "associationwidget.h"
 #include "activitywidget.h"
+#include "widget_utils.h"
 #include "umlview.h"
 #include "linepath.h"
 
@@ -437,25 +438,18 @@
 
 void LinePath::setupSelected() {
 	m_RectList.clear();
-	const int SIZE = 4;
 	QCanvasLine * line = 0;
 	LineListIt it( m_LineList );
 	while( ( line = it.current() ) ) {
 		QPoint sp = line -> startPoint();
-		QCanvasRectangle * rect = new QCanvasRectangle( sp.x() - SIZE / 2, sp.y() - SIZE / 2, SIZE, SIZE, getCanvas() );
-		rect -> setBrush( QBrush( blue ) );
-		rect -> setPen( QPen( blue ) );
-		rect -> setVisible( true );
+		QCanvasRectangle *rect = Umbrello::decoratePoint(sp);
 		m_RectList.append( rect );
 		++it;
 	}
 	//special case for last point
 	line = m_LineList.last();
 	QPoint p = line -> endPoint();
-	QCanvasRectangle * rect = new QCanvasRectangle( p.x() - SIZE / 2, p.y() - SIZE / 2, SIZE, SIZE, getCanvas() );
-	rect -> setBrush( QBrush( blue ) );
-	rect -> setPen( QPen( blue ) );
-	rect -> setVisible( true );
+	QCanvasRectangle *rect = Umbrello::decoratePoint(p);
 	m_RectList.append( rect );
 	update();
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/widget_utils.cpp #410428:410429
@@ -16,10 +16,15 @@
 #include "widget_utils.h"
 
 // qt/kde includes
+#include <qcanvas.h>
+#include <qbrush.h>
+#include <qpen.h>
 #include <kiconloader.h>
 #include <kdebug.h>
 
 // app includes
+#include "uml.h"
+#include "umlview.h"
 #include "umlwidget.h"
 #include "objectwidget.h"
 
@@ -90,6 +95,19 @@
 	return diagramIconSet;
 }
 
+QCanvasRectangle *decoratePoint(QPoint p) {
+	const int SIZE = 4;
+	UMLView *currentView = UMLApp::app()->getCurrentView();
+	QCanvasRectangle *rect;
+	rect = new QCanvasRectangle(p.x() - SIZE / 2,
+				    p.y() - SIZE / 2,
+				    SIZE, SIZE, currentView->canvas());
+	rect->setBrush( QBrush(Qt::blue) );
+	rect->setPen( QPen(Qt::blue) );
+	rect->setVisible(true);
+	return rect;
+}
 
+
 }  // namespace Umbrello
 
--- trunk/KDE/kdesdk/umbrello/umbrello/widget_utils.h #410428:410429
@@ -16,10 +16,14 @@
 #define WIDGET_UTILS_H
 
 #include <qiconset.h>
+#include <qpoint.h>
 #include "umlnamespace.h"
 #include "umlwidgetlist.h"
 #include "messagewidgetlist.h"
 
+// forward declarations
+class QCanvasRectangle;
+
 /**
  * General purpose widget utilities.
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
@@ -39,12 +43,13 @@
 			      const UMLWidgetList& widgets,
 			      const MessageWidgetList* pMessages = NULL);
 
-
 	/**
 	 * Return the icon corresponding to the given Diagram_Type.
 	 */
 	QIconSet iconSet(Uml::Diagram_Type dt);
 
+	QCanvasRectangle *decoratePoint(QPoint p);
+
 }
 
 #endif




More information about the umbrello-devel mailing list