NodeGraphQt
NodeGraphQt copied to clipboard
If a widget has been hidden using hide_widget, it will reappear after the view is zoom-out and zoom-in
If a widget has been hidden using hide_widget, it will reappear after the viewer is zoom-out (very small) and zoom-in.
File: node_base.py
def set_proxy_mode(self, mode):
"""
Set whether to draw the node with proxy mode.
(proxy mode toggles visibility for some qgraphic items in the node.)
Args:
mode (bool): true to enable proxy mode.
"""
...
# node widget visibility. =>need to add some conditions<=
for w in self._widgets.values():
w.widget().setVisible(visible)
Just in case anyone needs, if you don't need proxy mode and want to disable this behaviour, you can just edit the "auto_switch_mode" method in "node_base.py" to:
def auto_switch_mode(self):
"""
Decide whether to draw the node with proxy mode.
(this is called at the start in the "self.paint()" function.)
"""
if ITEM_CACHE_MODE is QtWidgets.QGraphicsItem.ItemCoordinateCache:
return
rect = self.sceneBoundingRect()
l = self.viewer().mapToGlobal(
self.viewer().mapFromScene(rect.topLeft()))
r = self.viewer().mapToGlobal(
self.viewer().mapFromScene(rect.topRight()))
# width is the node width in screen
width = r.x() - l.x()
#self.set_proxy_mode(width < self._proxy_mode_threshold)
# TODO: maybe limit zoom instead?
self.set_proxy_mode(False)