mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-07 22:22:33 +01:00
Fix crash : qet crash when element comment (comment item and cross ref item) is bigger than the width of the rectangle where there are displayed.
The rectangle is now adjusted to the size of the comment. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4082 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -105,13 +105,14 @@ bool CommentItem::setTextParent() {
|
||||
* update the content of this item
|
||||
* (draw this item in a QPicture)
|
||||
*/
|
||||
void CommentItem::updateLabel() {
|
||||
void CommentItem::updateLabel()
|
||||
{
|
||||
QString comment = m_element -> elementInformations()["comment"].toString();
|
||||
|
||||
if (comment == m_comment && !m_text_parent) return;
|
||||
|
||||
if (comment != m_comment) {
|
||||
|
||||
if (comment != m_comment)
|
||||
{
|
||||
m_comment = comment;
|
||||
|
||||
QPen pen(Qt::black);
|
||||
@@ -121,10 +122,9 @@ void CommentItem::updateLabel() {
|
||||
painter.setPen (pen);
|
||||
painter.setFont (QETApp::diagramTextsFont(6));
|
||||
|
||||
QRectF drawing_rect(QPointF(0,0), QSizeF(70, 100));
|
||||
QRectF text_bounding;
|
||||
QRectF text_bounding = painter.boundingRect(QRectF(QPointF(0,0), QSizeF(70, 1)), Qt::TextWordWrap | Qt::AlignHCenter, m_comment);
|
||||
|
||||
painter.drawText(drawing_rect, Qt::TextWordWrap | Qt::AlignHCenter, m_comment, &text_bounding);
|
||||
painter.drawText(text_bounding, Qt::TextWordWrap | Qt::AlignHCenter, m_comment);
|
||||
|
||||
text_bounding.adjust(-1,0,1,0); //adjust only for better visual
|
||||
painter.drawRoundedRect(text_bounding, 2, 2);
|
||||
|
||||
Reference in New Issue
Block a user