Skip to content

Resize methods in the NodeItem class fail at a certain zoom level #447

Open
@aloytag

Description

@aloytag

Hi,

If I zoom out too far, at certain zoom level, custom widgets added with add_custom_widget() method disappear. I understand that this is normal when using QGraphicsView in Qt. It's related to the details that can be rendered at a very small size. In such a case, some node operations, e.g. changing the layout direction, may result in an erroneous resizing. This is due to some lines in NodeItem class definition like these:

if not widget.isVisible():
    continue

These lines are present in the methods: _calc_size_horizontal(), _calc_size_vertical(), _align_widgets_horizontal() and _align_widgets_vertical() (twice).

What happens is that the widgets are not visible for certain zoom levels (very zoomed out) and, consequently, those lines of code indicate that they should not be taken into account for calculating the node size. Then, when zooming in again, the boundingRect of the node may leave those widgets out.

For the moment, I commented those lines and everything seems to be working correctly. However, I'm not sure what side effects there may be.


NodeGraphQt version: 0.6.38
Qt.py version: 1.4.1
PyQt5 version: 5.15.10
Python version: 3.11.2
OS: Debian GNU/Linux 12 (bookworm)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions