[Uml-devel] branches/work/soc-umbrello/umbrello
Gopala Krishna A
krishna.ggk at gmail.com
Sat Aug 30 12:58:48 UTC 2008
SVN commit 854852 by gopala:
Add margin handling facility to TextItemGroup so that it becomes
easier to do calculations.
M +6 -2 textitemgroup.cpp
M +8 -0 textitemgroup.h
--- branches/work/soc-umbrello/umbrello/textitemgroup.cpp #854851:854852
@@ -28,6 +28,7 @@
TextItemGroup::TextItemGroup(QGraphicsItem *parent) :
m_parentItem(parent),
m_lineBreakageWidth(TextItemGroup::NoLineBreak),
+ m_margin(0),
m_alignment(Qt::AlignCenter),
m_fontColor(Qt::black),
m_hoverBrush(Qt::NoBrush),
@@ -150,6 +151,9 @@
height += calcItem->height();
}
+ width += 2 * m_margin;
+ height += 2 * m_margin;
+
delete calcItem;
return QSizeF(width, height);
@@ -175,8 +179,8 @@
}
qreal spacing = (rect.height() - minSize.height()) / (visibleItems.count() + 1);
- qreal x = rect.left();
- qreal y = rect.top() + spacing;
+ qreal x = rect.left() + m_margin;
+ qreal y = (rect.top() + m_margin) + spacing;
foreach(TextItem *item, visibleItems) {
item->setTextWidth(rect.width());
--- branches/work/soc-umbrello/umbrello/textitemgroup.h #854851:854852
@@ -68,6 +68,13 @@
}
void setLineBreakWidth(qreal w);
+ qreal margin() const {
+ return m_margin;
+ }
+ void setMargin(qreal m) {
+ m_margin = m;
+ }
+
QSizeF minimumSize() const;
QRectF groupGeometry() const {
@@ -105,6 +112,7 @@
QList<TextItem*> m_textItems;
QRectF m_groupGeometry;
qreal m_lineBreakageWidth;
+ qreal m_margin;
Qt::Alignment m_alignment;
QColor m_fontColor;
More information about the umbrello-devel
mailing list