Bug 152757 - Note widgets get resized when printing
Summary: Note widgets get resized when printing
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
: 153900 189749 298655 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-23 01:12 UTC by Andrew Fuller
Modified: 2013-11-06 17:16 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0


Attachments
rough patch (1.17 KB, patch)
2007-11-23 01:20 UTC, Andrew Fuller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuller 2007-11-23 01:12:48 UTC
Version:           1.92.1 (using KDE KDE 3.96.0)
Installed from:    Compiled From Sources
OS:                Linux

When printing (at least when generating a PDF, but I assume it's the same if it were to print directly), widgets seems to have their size recalculated.  This is a problem for notes, because calculateSize (which seems to really be a minimumSize from the uses I've seen) returns a fixed (small) size.  The end result is when you've made a lovely diagram with notes then print it, the notes shrink and cut off the text.
Comment 1 Andrew Fuller 2007-11-23 01:20:01 UTC
Created attachment 22164 [details]
rough patch

This is a rough patch that Works For Me.  It works by returning the current
size in calculateSize (which feels like a hack, perhaps someone who knows how
this stuff works can suggest something better).  I'm not familiar with any of
the note types (precondition, etc), so this only happens for Normal notes. 
Secondly, to permit manual resizing, UMLWidget::constrain is overridden and
turned into a no-op, otherwise calculateSize is used as minimum size and we
cannot shrink the notes.
Comment 2 Benoit Grégoire 2008-01-02 17:03:06 UTC
Haven't tested the patch, but Notes are definitely unusable when printed in umbrello 1.5.8.
Comment 3 James Muscat 2008-01-17 13:55:36 UTC
Notes and Boxes are both affected by this for me in both Umbrello 1.5.8 and Umbrello 2. The images created when exporting as DocBook work correctly, so there's a workaround of sorts.

I'm currently unable to test the patch.
Comment 4 Heggman 2008-11-11 12:38:23 UTC
This bug still happens with umbrello 2.1.2.
Comment 5 Peter M. Petrakis 2009-04-07 19:54:14 UTC
Confirmed with v2.2.1 on Fedora 10. It doesn't matter which way I print it. In my case, it's actually changing the working file as I print it, but the program
doesn't notice that it's been modified e.g. title bar notification.
Comment 6 Tom Hanson 2010-03-12 18:37:02 UTC
Still exists in 2.3.2.  For CombinedFragment, text boxes, etc. calculateSize determines the "appropriate" size based on the text contents of the element.  This is an invalid assumption for elements such as CombinedFragment which are sized by the user to bound part of the diagram.
Comment 7 Ralf Habacker 2012-05-31 21:01:27 UTC
*** Bug 298655 has been marked as a duplicate of this bug. ***
Comment 8 Ralf Habacker 2012-05-31 21:05:47 UTC
*** Bug 153900 has been marked as a duplicate of this bug. ***
Comment 9 Ralf Habacker 2012-05-31 21:11:34 UTC
Setting #153900 as duplicate of this bug do add an empty note without the reference to this bug - a bug in the bug tracker ?
Comment 10 Ralf Habacker 2012-05-31 21:34:58 UTC
*** Bug 189749 has been marked as a duplicate of this bug. ***
Comment 11 Ralf Habacker 2012-06-03 07:24:31 UTC
SVN commit 1298057 by habacker:

Changed widget auto resizing to noop for now, because minimumSize()
do not work in all cases and need to be refactored.


 M  +1 -2      umlwidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1298057
Comment 12 Ralf Habacker 2012-06-05 05:17:33 UTC
Reopened because further testing shows that some widgets (for example ClassifierWidget and ActorWidget depends on content related minimumSize for getting initial size on widget construction). The lets me assume that NoteWidget::minimalSize should return content related size for the default note type as it is done for the special note widget types. But what about the above mentioned "wrong" assumption ? 
A fix for the note widget is to add an additional virtual calculateSize() method wich return content based bounding box, which is used in UMLWidget::updateComponentSize(). The widget size will be limited to the lower or upper bounds when these limits are exceeded. 

/**
 * Update the size of this widget.
 */
void UMLWidget::updateComponentSize()
{
    if (m_doc->loading())
        return;
    QSize size = calculateSize();
    int clipWidth = size.width();
    int clipHeight = size.height();
    constrain(clipWidth, clipHeight);
    setSize(clipWidth, clipHeight);
    adjustAssocs(x(), y());    // adjust assoc lines
}
Comment 13 Ralf Habacker 2012-06-07 21:21:24 UTC
SVN commit 1298923 by habacker:

Separated minimum size calculation from content related to fix issues with widget construction size.


 M  +36 -1     notewidget.cpp  
 M  +1 -0      notewidget.h  
 M  +15 -1     umlwidget.cpp  
 M  +2 -0      umlwidget.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1298923
Comment 14 Ralf Habacker 2013-11-06 17:16:23 UTC
apply fixed bug from 4.9.0 changelog