QCollapsible#
Collapsible QFrame
that can be expanded or collapsed by clicking on the header.
from qtpy.QtWidgets import QApplication, QLabel, QPushButton
from superqt import QCollapsible
app = QApplication([])
collapsible = QCollapsible("Advanced analysis")
collapsible.addWidget(QLabel("This is the inside of the collapsible frame"))
for i in range(10):
collapsible.addWidget(QPushButton(f"Content button {i + 1}"))
collapsible.expand(animate=False)
collapsible.show()
app.exec_()
Qt Class#
Signals#
toggled
#
Methods#
A collapsible widget to hide and unhide child widgets.
A signal is emitted when the widget is expanded (True) or collapsed (False).
Based on https://stackoverflow.com/a/68141638
addWidget(widget: QWidget) -> None
#
Add a widget to the central content widget's layout.
collapse(animate: bool = True) -> None
#
Collapse (hide) the collapsible section.
collapsedIcon() -> QIcon
#
Returns the icon used when the widget is collapsed.
content() -> QWidget
#
Return the current content widget.
expand(animate: bool = True) -> None
#
Expand (show) the collapsible section.
expandedIcon() -> QIcon
#
Returns the icon used when the widget is expanded.
isExpanded() -> bool
#
Return whether the collapsible section is visible.
locked() -> bool
#
Return True if collapse/expand is disabled.
removeWidget(widget: QWidget) -> None
#
Remove widget from the central content widget's layout.
setCollapsedIcon(icon: Optional[Union[QIcon, str]] = None) -> None
#
Set the icon on the toggle button when the widget is collapsed.
setContent(content: QWidget) -> None
#
Replace central widget (the widget that gets expanded/collapsed).
setDuration(msecs: int) -> None
#
Set duration of the collapse/expand animation.
setEasingCurve(easing: QEasingCurve) -> None
#
Set the easing curve for the collapse/expand animation.
setExpandedIcon(icon: Optional[Union[QIcon, str]] = None) -> None
#
Set the icon on the toggle button when the widget is expanded.
setLocked(locked: bool = True) -> None
#
Set whether collapse/expand is disabled.
setText(text: str) -> None
#
Set the text of the toggle button.
text() -> str
#
Return the text of the toggle button.