mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
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:
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user