How do I trigger recalculation of expanders?

In my plugin source, I have created a compound undo/redo action on the history stack.

The undo moves a bunch of module positions back where they used to be. However, this repositioning of multiple modules messes up their expanders: they no longer think they are “connected” until I click somewhere on any module. Weirdly, even if I click on an unrelated module, my expanders suddenly snap back together.

My best guess is that I need to trigger some kind of event that recalculates expander relationships, and that clicking the mouse on any module is one such event.

How should I go about making my undo preserve the expander relationships?

Thanks in advance…

1 Like

I figured it out: I have to call APP->scene->rack->requestModulePos(widget, pos) instead of widget->setPos(pos). This calls a private internal function updateExpanders, and now my bug is gone.

2 Likes