From 9119d156c37aaf9eb0ab31510a70daee3d4ae75d Mon Sep 17 00:00:00 2001 From: blacksun Date: Thu, 4 Dec 2014 23:14:20 +0000 Subject: [PATCH] Comment item & cross ref item : reduce the size of the rectangle where is display the comment for better visual git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3531 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/commentitem.cpp | 2 +- sources/qetgraphicsitem/crossrefitem.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/qetgraphicsitem/commentitem.cpp b/sources/qetgraphicsitem/commentitem.cpp index 8526b0086..4c4b9baab 100644 --- a/sources/qetgraphicsitem/commentitem.cpp +++ b/sources/qetgraphicsitem/commentitem.cpp @@ -121,7 +121,7 @@ void CommentItem::updateLabel() { painter.setPen (pen); painter.setFont (QETApp::diagramTextsFont(6)); - QRectF drawing_rect(QPointF(0,0), QSizeF(100, 100)); + QRectF drawing_rect(QPointF(0,0), QSizeF(70, 100)); QRectF text_bounding; painter.drawText(drawing_rect, Qt::TextWordWrap | Qt::AlignHCenter, m_comment, &text_bounding); diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index d20fe8368..cd09306de 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -504,14 +504,15 @@ void CrossRefItem::fillCrossRef(QPainter &painter) { void CrossRefItem::AddExtraInfo(QPainter &painter) { QString comment = m_element-> elementInformations()["comment"].toString(); bool must_show = m_element-> elementInformations().keyMustShow("comment"); + if (!comment.isEmpty() && must_show) { painter.save(); painter.setFont(QETApp::diagramTextsFont(6)); QRectF r, text_bounding; qreal center = boundingRect().center().x(); - r = QRectF(QPointF(center - 50, boundingRect().bottom()), - QPointF(center + 50, boundingRect().bottom() + 50)); + r = QRectF(QPointF(center - 35, boundingRect().bottom()), + QPointF(center + 35, boundingRect().bottom() + 50)); painter.drawText(r, Qt::TextWordWrap | Qt::AlignHCenter, comment, &text_bounding); text_bounding.adjust(-1,0,1,0); //adjust only for better visual