[Uml-devel] use case styles
Jonathan Riddell
jri at jriddell.org
Fri Oct 19 07:25:14 UTC 2001
I was wondering, how come use cases are represented with the label outside
the oval. Every book that I've seen shows them inside the oval, which I
think makes more sence. A patch that I made (purely for my own interest)
to change this is below.
Jonathan Riddell
--- usecasewidget.cpp.orig Fri Oct 19 15:05:47 2001
+++ usecasewidget.cpp Fri Oct 19 15:07:32 2001
@@ -26,13 +26,13 @@
QFontMetrics fm = fontMetrics();
int fontHeight = fm.lineSpacing();
int w = width();
-
+
int middleX = w / 2;
int textStartY = UC_HEIGHT + UC_MARGIN;
-
- p.drawEllipse(middleX - UC_WIDTH / 2, 0, UC_WIDTH, UC_HEIGHT);
+
+ p.drawEllipse(middleX - w / 2, 0, w, w / 2);
p.setPen(black);
- p.drawText(UC_MARGIN, textStartY, w - UC_MARGIN * 2, fontHeight,
AlignCenter, name());
+ p.drawText(UC_MARGIN, (w / 4) - (fontHeight / 2), w - UC_MARGIN *
2, fontHeight, AlignCenter, name());
p.setPen(lineColor);
if(mouseOver)
drawMouseOver(&p);
@@ -46,8 +46,8 @@
int fontHeight = fm.lineSpacing();
int textWidth = fm.width(name());
int width = textWidth > UC_WIDTH?textWidth:UC_WIDTH;
- int height = UC_HEIGHT + fontHeight + UC_MARGIN;
-
+ int height = (width / 2) + UC_MARGIN;
+
width += UC_MARGIN * 2;
resize(width, height);
}
More information about the umbrello-devel
mailing list