Collapsible Sections
Collapsible-section dialog: SectionExpandButton toggling + CollapsibleDialog defining the sections.
Overview
quatm/GUI/widgets/theexpandables.py provides collapsible section components: CollapsibleDialog
(a QDialog subclass) organises several collapsible sections with a QTreeWidget whose header is
hidden; each section header is a SectionExpandButton button, and clicking it expands/collapses the
corresponding content.
Components
| Component | Description |
|---|---|
SectionExpandButton | Button that expands/collapses a section (QPushButton) |
CollapsibleDialog | Base class for dialogs to which collapsible sections can be added |
Key methods (CollapsibleDialog)
| Method | Description |
|---|---|
define_sections | Override this method to define all sections as (title, widget) tuples |
add_section | Add one collapsible section |
add_button / add_widget | Create a top-level entry containing a button / attach a content widget |
Usage
from quatm.GUI.widgets.theexpandables import CollapsibleDialog
class MyDialog(CollapsibleDialog):
def define_sections(self):
self.add_section("Parameters", some_widget)
self.add_section("Advanced", advanced_widget)
dlg = MyDialog()
dlg.define_sections()
dlg.show()
For a fuller description see Collapsible components.