Repository: pyqtgraph/pyqtgraph

Issue:
Hiding nested group parameters
Hiding groups nested in groups does not work after the widget is shown. Look at this minimal example:

```
import os
import pyqtgraph.parametertree.ParameterTree as ParameterTree
from pyqtgraph.parametertree import Parameter, parameterTypes
from pyqtgraph.Qt import QtCore, QtGui

class MyGroup(parameterTypes.GroupParameter):

    def __init__(self, *args):
        super().__init__(name='GroupA')
        self.addChild(parameterTypes.ListParameter(name='idx', values=[0, 1, 2, 3], value=0))
        for i in range(4):
            self.addChild(Parameter.create(name=str(i), type='group', children=[{
                'name' : 'member', 'type' : 'str'
            }]))
           # self.addChild(Parameter.create(name=str(i), type='str')) # works fine

    def treeStateChanged(self, param, changes):
        super().treeStateChanged(param, changes)
        if param is self.child('idx'):
            # Show the element at this index
            self.update_value()
        
    def update_value(self):
        # Destroy the old child
        idx = self.child('idx').value()
        for child in self.children():
            if child.name() != 'idx' and child.name() != str(idx):
                child.hide()
        self.child(str(idx)).show()

p = MyGroup()
tree.addParameters(p)
win = QtGui.QWidget()
layout = QtGui.QGridLayout()
win.setLayout(layout)
layout.addWidget(tree)
win.show()

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
```

I create a Group that holds a list parameter, the value of which determines, which of the subgroups should be visible. When setting up the tree, all works well, only the group with name '0' is visible. However when changing the value of the list parameter 'idx', no changes appear whatsoever. Note that when using any parameter type other than group, (that is, instead of adding group parameters as children appending e.g. action, str, etc.) everything works just as intended.


Discussion:
Similar situation.
Nothing happen on the GUI when trying to hide group parameter.
same thing here.
has anybody found a work around for this issue?

may is related to this issue: https://github.com/pyqtgraph/pyqtgraph/issues/1130
Tested environment(s)

    PyQtGraph version: 0.11.0.dev0+g556ba55
    Qt Python binding: PySide2 5.14.1
    Python version: 3.7
    NumPy version: 1.18.1
    Operating system: Windows 10
    Installation method: WinPython


Resolving patch:
diff --git a/pyqtgraph/parametertree/parameterTypes.py b/pyqtgraph/parametertree/parameterTypes.py
--- a/pyqtgraph/parametertree/parameterTypes.py
+++ b/pyqtgraph/parametertree/parameterTypes.py
@@ -437,8 +437,10 @@ def addChild(self, child):  ## make sure added childs are actually inserted befo
         else:
             ParameterItem.addChild(self, child)
             
-    def optsChanged(self, param, changed):
-        if 'addList' in changed:
+    def optsChanged(self, param, opts):
+        ParameterItem.optsChanged(self, param, opts)
+        
+        if 'addList' in opts:
             self.updateAddList()
                 
     def updateAddList(self):


Test patch: