I've followed this post, using the QGIS Desktop Python Console, to create color ranges for my vector layer. QGIS displays a nice selectable tree in the Layers Panel.
Now I want to develop my own app, instead of playing in the console. How can I replicate this tree? If I only had top-level layers, I think it would be straightforward to get the list of layers from QgsMapLayerRegistry and populate my own widget. But the ranges add complexity. As far as I can tell, the sub-layers exist only in the renderer, so do I really need to dig through the renderer's items somehow?
I'm stuck with QGIS v2.18 and PyQt4 in case it matters.