mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-20 00:39:58 +02:00
Element text item group can now be framed.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5410 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -184,6 +184,30 @@ Qt::Alignment DiagramTextItem::alignment() const
|
||||
return m_alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramTextItem::frameRect
|
||||
* @return the rect used to draw a frame around this text
|
||||
*/
|
||||
QRectF DiagramTextItem::frameRect() const
|
||||
{
|
||||
//Get the bounding rectangle of the text
|
||||
QSizeF size = document()->size();
|
||||
size.setWidth(document()->idealWidth());
|
||||
//Remove the margin. Size is exactly the bounding rect of the text
|
||||
size.rheight() -= document()->documentMargin()*2;
|
||||
size.rwidth() -= document()->documentMargin()*2;
|
||||
//Add a little margin only for a better visual;
|
||||
size.rheight() += 2;
|
||||
size.rwidth() += 2;
|
||||
|
||||
//The pos of the rect
|
||||
QPointF pos = boundingRect().center();
|
||||
pos.rx() -= size.width()/2;
|
||||
pos.ry() -= size.height()/2;
|
||||
|
||||
return QRectF(pos, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramTextItem::paint
|
||||
* Draw this text field. This method draw the text by calling QGraphicsTextItem::paint.
|
||||
|
||||
Reference in New Issue
Block a user