VirtualList
为长列表或不等高集合布局并绘制可见部分。
正在加载交互演示…
div()
.h(210.0)
.overflow_hidden()
.virtual_scroll(&list)
.children(list.visible_rows().range.map(|index| text(format!("Row {index}"))))#导入
从 quickgui 导入 VirtualList。
use quickgui::*;#用法
div()
.h(210.0)
.overflow_hidden()
.virtual_scroll(&list)
.children(list.visible_rows().range.map(|index| text(format!("Row {index}"))))#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
VirtualList
查看源码pub fn new(len: usize, row_height: f32) -> Selfwith_overscanpub fn with_overscan(mut self, rows: usize) -> Self—
lenpub fn len(&self) -> usize—
is_emptypub fn is_empty(&self) -> bool—
row_heightpub fn row_height(&self) -> f32—
content_heightpub fn content_height(&self) -> f32—
viewport_heightpub fn viewport_height(&self) -> f32—
set_viewport_heightpub fn set_viewport_height(&mut self, height: f32) -> bool—
Configures set viewport height for this part.
pub fn set_viewport_height(&mut self, height: f32) -> bool查看源码set_lenpub fn set_len(&mut self, len: usize) -> bool—
scroll_offsetpub fn scroll_offset(&self) -> f32—
max_scroll_offsetpub fn max_scroll_offset(&self) -> f32—
scroll_bypub fn scroll_by(&mut self, delta: f32) -> bool—
scroll_topub fn scroll_to(&mut self, offset: f32) -> bool—
scroll_to_revealpub fn scroll_to_reveal(&mut self, index: usize) -> bool—
Scroll the smallest distance needed to expose one complete row.
pub fn scroll_to_reveal(&mut self, index: usize) -> bool查看源码visible_rowspub fn visible_rows(&self) -> VisibleRows—
row_rectpub fn row_rect(&self, index: usize, viewport_x: f32, viewport_y: f32, width: f32) -> Rect—
The logical rectangle for a row inside a viewport whose top is `viewport_y`.
pub fn row_rect(&self, index: usize, viewport_x: f32, viewport_y: f32, width: f32) -> Rect查看源码scrollbar_thumbpub fn scrollbar_thumb(&self, minimum_height: f32) -> Option<(f32, f32)>—
Returns `(thumb_offset, thumb_height)` in viewport-local coordinates.
pub fn scrollbar_thumb(&self, minimum_height: f32) -> Option<(f32, f32)>查看源码virtual_scrollpub fn virtual_scroll(mut self, list: &VirtualList) -> Self—
Bind this clipped viewport to a fixed-height [`VirtualList`]. The mounted rows remain application-controlled, while QuickGUI owns the native-style retained scrollbar, wheel routing, pointer capture, hover expansion, and one-shot autohide. Offset changes rebuild the virtualized view only when the offset actually moves; hover and visibility changes stay paint-only.
pub fn virtual_scroll(mut self, list: &VirtualList) -> Self查看源码childrenpub fn children<I, E>(mut self, children: I) -> Self where I: IntoIterator<Item = E>, E: IntoElement,—
Configures children for this part.
pub fn children<I, E>(mut self, children: I) -> Self where I: IntoIterator<Item = E>, E: IntoElement,查看源码