Bug 423660 - Class Diagram Widget Text Truncated Upon Re-Opening XMI
Summary: Class Diagram Widget Text Truncated Upon Re-Opening XMI
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.31.1 (KDE releases 20.04.1)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-29 15:19 UTC by Stanley Rekofsky
Modified: 2020-07-01 17:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.31.3 (KDE releases 20.04.3)


Attachments
Class diagram showing the truncated text. (36.25 KB, image/png)
2020-06-29 15:19 UTC, Stanley Rekofsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stanley Rekofsky 2020-06-29 15:19:44 UTC
Created attachment 129766 [details]
Class diagram showing the truncated text.

SUMMARY

Class Diagram attributes and operation text looks good when diagram initially created. Upon saving the XMI and re-opening the XMI on the same device/display all Class widgets have the text information in them truncated.

STEPS TO REPRODUCE
1. Class diagram settings as follows:
 - Show grid, Snap to grid, and Snap component size all checked.
 - Class Display Options to show Operations, Operation signature, Attributes, and Attribute signature all checked.
 - Created a simple class diagram with 3 classes showing all details and relationships.
2. Saved XMI and exit.
3. Re-open on same device and monitor.
4. Class attributes and operation text are truncated and re-sizing diagram does not restore text in Class widget. Expanding Class widget size does not restore text in Class widget.

OBSERVED RESULT
Text is truncated.

EXPECTED RESULT
Text to be displayed in it entirety.

SOFTWARE/OS VERSIONS
Umbrello V2.31.1 running under Windows 10. 

ADDITIONAL INFORMATION
Is there some additional diagram setting that needs to be checked?

Or is this an existing bug?
Comment 1 Ralf Habacker 2020-06-30 22:22:05 UTC
(In reply to Stanley Rekofsky from comment #0)
> Is there some additional diagram setting that needs to be checked?

After loading such files changing the default font fixes this issue for the currently loaded file. 


> Or is this an existing bug?
I did not recognized this bug before, which a Windows 10 specific bug.
It would be for interest, if this bug is present in previous releases and if not, with which version it was introduced. Previous releases can be downloaded from https://download.kde.org/stable/umbrello/
Comment 2 Ralf Habacker 2020-06-30 22:57:58 UTC
(In reply to Stanley Rekofsky from comment #0)
> Upon saving the XMI and re-opening the XMI on the same device/display
> all Class widgets have the text information in them truncated.

From inspecting the source it looks that the clipping happens in ClassifierWidget::drawMembers() where class attributes and operations are displayed. Inside the method a call to 

    painter->drawText(x, y, fontMetrics.size(0, text).width(), fontHeight, Qt::AlignVCenter, text);

is performed, where the text width in pixel is determined by the term `fontMetrics.size(0, text).width()`.
Comment 3 Ralf Habacker 2020-07-01 10:25:20 UTC
Git commit 15bb50e2ec5c6438eb13c012de1ccf177f3e98e4 by Ralf Habacker.
Committed on 01/07/2020 at 10:24.
Pushed by habacker into branch 'release/20.04'.

Fix 'Class Diagram Widget Text Truncated Upon Re-Opening XMI' on Windows 10

In ClassifierWidget::drawMembers() and ClassifierWidget::paint() the text
width is now calculated from the width of the widget instead of using the
QFontMetric instance, which fails under certain conditions on Windows 10.
FIXED-IN:2.31.3 (KDE releases 20.04.3)

M  +10   -9    umbrello/umlwidgets/classifierwidget.cpp
M  +1    -1    umbrello/umlwidgets/classifierwidget.h

https://invent.kde.org/sdk/umbrello/commit/15bb50e2ec5c6438eb13c012de1ccf177f3e98e4
Comment 4 Ralf Habacker 2020-07-01 17:01:42 UTC
A snapshot with an appropriate bug fix for Windows can be downloaded from https://umbrello.kde.org/snapshots.php.