Bug 298655

Summary: Use Case View: Notes resized after print/print preview
Product: [Applications] umbrello Reporter: Florian <floeschie>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED DUPLICATE    
Severity: major CC: ralf.habacker
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshots of Note items

Description Florian 2012-04-23 11:53:34 UTC
I added a note item to my Use Case diagram. I have set the text to "Opt-in?", but in order to make the text visible, I had to resize (widen) the note. After clicking printing/print preview, Umbrello resets the size of all note items to the default size and thus the text is not visible anymore.

Reproducible: Always

Steps to Reproduce:
1. Add a Note item to a Use Case diagram
2. Change text to "Opt-in?" (or anything else)
3. Resize the Note item until text is visible
4. Open print preview
Actual Results:  
Note items are resized to default size, text is not visible.

Expected Results:  
Do not change size of a Note item, in order to keep the text visible in printouts

Umbrello UML Modeller
Version 2.8.2
Using KDE Development Platform 4.8.2 (4.8.2)
Comment 1 Florian 2012-04-23 12:01:39 UTC
Created attachment 70586 [details]
Screenshots of Note items
Comment 2 Florian 2012-04-23 12:13:04 UTC
Same issue with Box items, too.
Comment 3 Ralf Habacker 2012-05-30 11:52:32 UTC
The problem is caused by the implementation of UMLWidget::updateComponentSize(), which casts the widget size to the minimum size of the widget. 

This is the related call stack: 
umbrello.exe!UMLWidget::updateComponentSize()  Zeile 1298	C++
umbrello.exe!UMLWidget::forceUpdateFontMetrics(QPainter * painter)  Zeile 1447	C++
umbrello.exe!UMLScene::forceUpdateWidgetFontMetrics(QPainter * painter)  Zeile 3885	C++
umbrello.exe!UMLScene::print(QPrinter * pPrinter, QPainter & pPainter)  Zeile 516	C++
umbrello.exe!UMLDoc::print(QPrinter * pPrinter, DiagramPrintPage * selectPage)  Zeile 2570	C++
umbrello.exe!UMLApp::slotPrintPreviewPaintRequested(QPrinter * printer)  Zeile 1323	C++

I changed the implementation of updateComponentSize() to 
/**
 * Update the size of this widget.
 */
void UMLWidget::updateComponentSize()
{
    if (m_doc->loading())
        return;
-    QSize size = minimumSize();
-    setSize(size.width(), size.height());
+   clipSize();
    adjustAssocs(x(), y());    // adjust assoc lines
}

which is a workaround for this issue.
Comment 4 Ralf Habacker 2012-05-31 06:11:44 UTC
Further digging shows the real problem which is located in minimumSize():

UMLSceneSize NoteWidget::minimumSize()
{
    int width = 60;
    int height = 30;
       if (....)
       ...    
      else {
        // keep width and height unchanged
    }
    return UMLSceneSize(width, height);
}

For default notes the size is mapped to hardcoded values instead of leaving unchanged as indicated by the comment.
Comment 5 Ralf Habacker 2012-05-31 21:01:27 UTC

*** This bug has been marked as a duplicate of bug 152757 ***