[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello
Caroline Bourdeu d'Aguerre
cbda at free.fr
Sun Feb 4 18:14:27 UTC 2007
SVN commit 630202 by bourdeu:
Add the guard of the operation loop of combined fragment.
M +17 -8 combinedfragmentwidget.cpp
M +3 -1 dialog_utils.cpp
--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.cpp #630201:630202
@@ -46,6 +46,7 @@
void CombinedFragmentWidget::draw(QPainter & p, int offsetX, int offsetY) {
int w = width();
int h = height();
+ int line_width = 45;
UMLWidget::setPen(p);
@@ -62,18 +63,14 @@
int textStartY = (h / 2) - (fontHeight / 2);
p.drawRect(offsetX, offsetY, w, h );
- p.drawLine(offsetX, offsetY + 20, offsetX + 45, offsetY + 20);
- p.drawLine(offsetX + 45, offsetY + 20, offsetX + 55, offsetY + 10);
- p.drawLine(offsetX + 55, offsetY + 10, offsetX + 55, offsetY);
-
p.setPen(Qt::black);
p.setFont( UMLWidget::getFont() );
+ QString temp = "loop";
switch ( m_CombinedFragment )
{
case Ref :
-
- p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY + textStartY, w - COMBINED_FRAGMENT_MARGIN * 2 + 50, fontHeight, Qt::AlignCenter, combined_fragment_value);
+ p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY + textStartY, w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignCenter, combined_fragment_value);
p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY , w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, "ref");
break;
@@ -89,8 +86,13 @@
break;
case Loop :
- p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY ,
- w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, "loop");
+ if (combined_fragment_value != "-")
+ {
+ temp += " [" + combined_fragment_value + "]";
+ line_width += (combined_fragment_value.size() + 2) * 8;
+ }
+ p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY ,w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, temp);
+
break;
case Neg :
@@ -112,6 +114,11 @@
default : break;
}
}
+ p.setPen(Qt::red);
+ p.drawLine(offsetX, offsetY + 20, offsetX + line_width, offsetY + 20);
+ p.drawLine(offsetX + line_width, offsetY + 20, offsetX + line_width + 10, offsetY + 10);
+ p.drawLine(offsetX + line_width + 10, offsetY + 10, offsetX + line_width + 10, offsetY);
+
if(m_bSelected)
drawSelected(&p, offsetX, offsetY);
}
@@ -123,6 +130,8 @@
const int textWidth = fm.width(getName());
height = fontHeight;
width = textWidth + 60 > COMBINED_FRAGMENT_WIDTH ? textWidth + 60: COMBINED_FRAGMENT_WIDTH;
+ if ( m_CombinedFragment == Loop )
+ width += textWidth * 0.4;
height = height > COMBINED_FRAGMENT_HEIGHT ? height : COMBINED_FRAGMENT_HEIGHT;
width += COMBINED_FRAGMENT_MARGIN * 2;
height += COMBINED_FRAGMENT_MARGIN * 2;
--- branches/work/isi-umbrello/umbrello/umbrello/dialog_utils.cpp #630201:630202
@@ -69,8 +69,10 @@
if (pressedOK) {
QString type = result.join("");
dynamic_cast<CombinedFragmentWidget*>(targetWidget)->setCombinedFragmentType(type);
- if (type == "Reference" )
+ if (type == "Reference")
askNameForWidget(targetWidget, i18n("Enter the name of the diagram referenced"), i18n("Enter the name of the diagram referenced"), i18n("Diagram name"));
+ if (type == "Loop")
+ askNameForWidget(targetWidget, i18n("Enter the guard of the loop"), i18n("Enter the guard of the loop"), i18n("-"));
} else {
targetWidget->cleanup();
delete targetWidget;
More information about the umbrello-devel
mailing list