Skip to content

Conversation

@Gabrielnmds
Copy link

@Gabrielnmds Gabrielnmds commented Dec 17, 2025

Type of change

  • New feature

Description

The zoom fit selected and zoom fit all features allow for the user to change focus between one, some or all exiting nodes, fitting them in the view accordingly. The video below demonstrates both functionalities:

Zoom_fit_test.mp4

Testing

  • Qt version tested:
  • Existing tests still pass

tatatupi and others added 30 commits June 20, 2025 15:26
Integrate upstream
…-from-nodedelegatemodel

Add UI update signal
g-abilio and others added 9 commits December 3, 2025 11:20
* improves NodeValidationState struct

* qt6 for linux-gcc

* Adds node nickname functionality

* Adjust label layout

* improve caption and nickname dynamic

* Add editable nickname label

* add correct caption dynamic, as well as labelEdit max size

* fix alignment issues between nickname and node caption

* revert workflows change

* fix segfault detected in dataflowgraphmodel tests

* produces optional nickname structure and adds example

* fix typo in spacing method and attribute

* uniformizes icon files attributes

* removes commented code

* improves processing status icon resolution

* solves situations where icons should not appear

* adds docstring to each nodeprocessingstatus

* adds possibility to change the node processing status icon style

* moves all status logic to NodeStyle

* removes unnecessary code

* adds declaration of QPixmap

---------

Co-authored-by: Taiguara Tupinambás <[email protected]>
Co-authored-by: Gabrielnmds <[email protected]>
Copy link
Collaborator

@Llcoolsouder Llcoolsouder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version of contextMenuEvent allows subclasses to completely customize what shows in the context menu. This change would make it so every subclass gets the zoom actions menu (but only if connected to a DataFlowGraphModel).

It might be more in the spirit to the original to keep the new zoom actions as public methods, but leave them disconnected, allowing end users to connect them where they see fit. (We could have a whole collection of inherited default impl actions that could be useful in this way.)

Comment on lines 192 to +209
{
if (itemAt(event->pos())) {
QGraphicsView::contextMenuEvent(event);
return;
}
QGraphicsView::contextMenuEvent(event);
QMenu *menu = nullptr;

if (!nodeScene()) return;
bool isZoomFitMenu = false;

auto const scenePos = mapToScene(event->pos());
auto *dfModel = &nodeScene()->graphModel();
auto n = qgraphicsitem_cast<NodeGraphicsObject *>(itemAt(event->pos()));

QMenu *menu = nodeScene()->createSceneMenu(scenePos);
if (dfModel && n) {
isZoomFitMenu = dfModel->nodeZoomFitMenu(n->nodeId());
}

if (itemAt(event->pos()) && isZoomFitMenu) {
menu = nodeScene()->createZoomMenu(mapToScene(event->pos()));
} else if (!itemAt(event->pos())) {
menu = nodeScene()->createSceneMenu(mapToScene(event->pos()));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple thoughts here:

  1. There's already a signal we could connect to for node-specific context menus (i.e. on node right clicked) so this might not actually be the best place for checking for itemAt() and calling our menu code.
    https://github.com/search?q=repo%3Apaceholder%2Fnodeeditor%20nodeContextMenu&type=code
  2. Zoom to fit selected (or all) aren't really specific to the node you're right clicking. Shouldn't these menu items be added to the more general scene menu? That way, right clicking empty space brings up the zoom options, but right clicking a node brings up the node-specific actions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll check that signal and try changing how the verification and call are made. Thanks for the suggestion!

Regarding the zoom fit options, the feature works as follows:

  1. Zoom Fit Selected zoom fits the selected nodes.
  2. Zoom Fit All zoom fits all the nodes in the canvas.

The right-click context menu is only triggered when the right button is on a selected node because right-clicking on the empty screen triggers the node context menu. Therefore, we thought it would be better to do this so as not to create an extensive context menu with multiple options (i.e., nodes and node-specific actions).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember that this is just one example of how to use the Zoom Fit feature. Therefore, this feature can be implemented in the application in many ways by the developer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging @paceholder for final review on this bit.
If he's cool with it, I'm not going to dig my heels in.

lsouder-ozone3d

This comment was marked as duplicate.

Copy link
Collaborator

@Llcoolsouder Llcoolsouder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a bunch of other changes have leaked into this PR.

This reverts commit e828567, reversing
changes made to 8d6c26b.
@g-abilio
Copy link
Contributor

It looks like a bunch of other changes have leaked into this PR.

Solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants