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
This commit is contained in:
blacksun
2014-12-04 23:14:20 +00:00
parent 8070f7eedb
commit 9119d156c3
2 changed files with 4 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ void CommentItem::updateLabel() {
painter.setPen (pen); painter.setPen (pen);
painter.setFont (QETApp::diagramTextsFont(6)); 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; QRectF text_bounding;
painter.drawText(drawing_rect, Qt::TextWordWrap | Qt::AlignHCenter, m_comment, &text_bounding); painter.drawText(drawing_rect, Qt::TextWordWrap | Qt::AlignHCenter, m_comment, &text_bounding);

View File

@@ -504,14 +504,15 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
void CrossRefItem::AddExtraInfo(QPainter &painter) { void CrossRefItem::AddExtraInfo(QPainter &painter) {
QString comment = m_element-> elementInformations()["comment"].toString(); QString comment = m_element-> elementInformations()["comment"].toString();
bool must_show = m_element-> elementInformations().keyMustShow("comment"); bool must_show = m_element-> elementInformations().keyMustShow("comment");
if (!comment.isEmpty() && must_show) { if (!comment.isEmpty() && must_show) {
painter.save(); painter.save();
painter.setFont(QETApp::diagramTextsFont(6)); painter.setFont(QETApp::diagramTextsFont(6));
QRectF r, text_bounding; QRectF r, text_bounding;
qreal center = boundingRect().center().x(); qreal center = boundingRect().center().x();
r = QRectF(QPointF(center - 50, boundingRect().bottom()), r = QRectF(QPointF(center - 35, boundingRect().bottom()),
QPointF(center + 50, boundingRect().bottom() + 50)); QPointF(center + 35, boundingRect().bottom() + 50));
painter.drawText(r, Qt::TextWordWrap | Qt::AlignHCenter, comment, &text_bounding); painter.drawText(r, Qt::TextWordWrap | Qt::AlignHCenter, comment, &text_bounding);
text_bounding.adjust(-1,0,1,0); //adjust only for better visual text_bounding.adjust(-1,0,1,0); //adjust only for better visual