public class ScrollPane extends Container:
Clipped viewport for a vertically scrollable widget hierarchy.
The pane keeps ordinary child widgets fully interactive while translating its content container. The mouse wheel, the scrollbar track and direct thumb dragging all update the same scroll offset.
pane = ScrollPane(VBoxLayout(spacing=8))
pane.addContent(Label("First row"))
pane.addContent(Label("Second row"))
pane.contentHeight = 400
window.centralWidget.add(pane)| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | contentcontent as Container: |
Container translated inside the viewport. |
| public property | contentHeightcontentHeight as Int: |
Full vertical extent of the scrollable content in pixels. |
| public property | scrollOffsetscrollOffset as Int: |
Current vertical offset in pixels. |
| public property | scrollStepscrollStep as Int = 44 |
Number of pixels moved for one normalized wheel step. |
| public property | scrollbarWidthscrollbarWidth as Int = 10 |
Width reserved for the vertical scrollbar. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | ScrollPaneScrollPane(contentLayout as Layout = null): |
Creates a pane whose content optionally uses a layout manager. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | addContentaddContent(widget as Widget) as Void: |
Adds an interactive widget to the scrollable content. |
| public | clearContentclearContent() as Void: |
Removes all widgets from the scrollable content and resets the viewport. |
| public override | paintpaint(painter as Painter) as Void: |
No summary. |
| public | scrollBy | Scrolls by a signed pixel distance and returns whether the view moved. |
| public override | setBounds | No summary. |