[umbrello] [Bug 446020] Bird's eye view shows nothing at first open

Robert Hairgrove bugzilla_noreply at kde.org
Thu Dec 30 13:09:50 GMT 2021


https://bugs.kde.org/show_bug.cgi?id=446020

--- Comment #5 from Robert Hairgrove <code at roberthairgrove.com> ---
(In reply to Oliver Kellogg from comment #4)
> (...) - In function resizeSceneToItems, as an experimental change comment out
>   call to setSceneRect(itemsBoundingRect()).
>   It appears that the function resizeSceneToItems may be removed
>   altogether (subject to further tests).

Thanks for looking into this, Oliver. In the meantime, I saw that
QGraphicsScene will use itemsBoundingRect() anyway if no scene rect was
previously set (in Qt docs). However, the strange drawing behavior of the
diagrams when only a few objects/widgets are shown, and by extension of the
bird's view, seems to stem from the fact that the scene has no minimum rect
with sensible defaults for width and height.

If I add two dummy widgets, one in the upper left corner and the other in the
lower right corner, and keep moving them farther apart by scaling the view size
down, then I can draw and resize other objects normally which lie inside of the
bounding rect determined by the two dummy widgets. Also, the bird's eye view
then works as one would expect. Dragging one object in one direction and having
others move in the opposite direction is an optical illusion created by the
fact that QGraphicssScene will try to keep all objects contained by it
centered. Looking at the Qt example code in the "diagramscene" example, the
scene's area is set in the constructor  of MainWindow to (0,0,5000,5000) and it
never changes.

I don't know if this would work for Umbrello (when calling
saveTo/loadFromXMI(), for example), but we could try starting out with a
default size of 800 x 1100 pixels (which would correspond roughly to a single
A4 page in portrait orientation with 96 DPI) and call resizeSceneToItems() only
if the scene needs to grow its size or if the user selects "Fit" from the scale
control. Perhaps this could be user-configurable? I recall reading somewhere
that it is considered best practice only to include as much detail in a single
UML diagram as will fit on a single A4 or US Letter size page... but cannot
remember where I saw this.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list