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

ComponentDescription
SectionExpandButtonButton that expands/collapses a section (QPushButton)
CollapsibleDialogBase class for dialogs to which collapsible sections can be added

Key methods (CollapsibleDialog)

MethodDescription
define_sectionsOverride this method to define all sections as (title, widget) tuples
add_sectionAdd one collapsible section
add_button / add_widgetCreate 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.