[Uml-devel] KDE/kdesdk/umbrello/umbrello/widgets
Ralf Habacker
ralf.habacker at gmail.com
Wed Jan 18 15:29:41 UTC 2012
SVN commit 1274513 by habacker:
Refactored to use new minimum/maximum api.
M +24 -23 activitywidget.cpp
M +3 -1 activitywidget.h
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.cpp #1274512:1274513
@@ -327,28 +327,14 @@
UMLWidget::constrain(width, height);
return;
}
+
if (width > height)
width = height;
else if (height > width)
height = width;
- if (m_activityType == Branch) {
- if (width < 20) {
- width = 20;
- height = 20;
- } else if (width > 50) {
- width = 50;
- height = 50;
+
+ UMLWidget::constrain(width, height);
}
- } else {
- if (width < 15) {
- width = 15;
- height = 15;
- } else if (width > 30) {
- width = 30;
- height = 30;
- }
- }
-}
/**
* Captures any popup menu signals for menus it created.
@@ -382,13 +368,12 @@
*/
UMLSceneSize ActivityWidget::minimumSize()
{
- int width, height;
if ( m_activityType == Normal || m_activityType == Invok || m_activityType == Param ) {
const QFontMetrics &fm = getFontMetrics(FT_NORMAL);
const int fontHeight = fm.lineSpacing();
int textWidth = fm.width(name());
- height = fontHeight;
+ int height = fontHeight;
height = height > ACTIVITY_HEIGHT ? height : ACTIVITY_HEIGHT;
height += ACTIVITY_MARGIN * 2;
@@ -407,14 +392,30 @@
height += 100;
}
- width = textWidth > ACTIVITY_WIDTH ? textWidth : ACTIVITY_WIDTH;
+ int width = textWidth > ACTIVITY_WIDTH ? textWidth : ACTIVITY_WIDTH;
width += ACTIVITY_MARGIN * 4;
+ return UMLSceneSize(width, height);
+ }
+ else if (m_activityType == Branch) {
+ return UMLSceneSize(20, 20);
+ }
+ return UMLSceneSize(15, 15);
+}
- } else {
- width = height = 20;
+/**
+ * Overrides method from UMLWidget
+ */
+UMLSceneSize ActivityWidget::maximumSize()
+{
+ if (m_activityType == Normal || m_activityType == Invok || m_activityType == Param) {
+ return UMLWidget::maximumSize();
}
- return QSize(width, height);
+ if (m_activityType == Branch) {
+ return UMLSceneSize(50,50);
}
+ return UMLSceneSize(30,30);
+}
+
#include "activitywidget.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.h #1274512:1274513
@@ -75,7 +75,9 @@
virtual void slotMenuSelection(QAction* action);
protected:
- UMLSceneSize minimumSize();
+ virtual UMLSceneSize minimumSize();
+ virtual UMLSceneSize maximumSize();
+
ActivityType m_activityType; ///< Type of activity.
/**
More information about the umbrello-devel
mailing list