跳到正文

VirtualList

为长列表或不等高集合布局并绘制可见部分。

正在加载交互演示…

#导入

从 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) -> Self
with_overscanpub fn with_overscan(mut self, rows: usize) -> Self—

Configures with overscan for this part.

pub fn with_overscan(mut self, rows: usize) -> Self
查看源码
lenpub fn len(&self) -> usize—

Configures len for this part.

pub fn len(&self) -> usize
查看源码
is_emptypub fn is_empty(&self) -> bool—

Configures is empty for this part.

pub fn is_empty(&self) -> bool
查看源码
row_heightpub fn row_height(&self) -> f32—

Configures row height for this part.

pub fn row_height(&self) -> f32
查看源码
content_heightpub fn content_height(&self) -> f32—

Configures content height for this part.

pub fn content_height(&self) -> f32
查看源码
viewport_heightpub fn viewport_height(&self) -> f32—

Configures viewport height for this part.

pub 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—

Configures set len for this part.

pub fn set_len(&mut self, len: usize) -> bool
查看源码
scroll_offsetpub fn scroll_offset(&self) -> f32—

Configures scroll offset for this part.

pub fn scroll_offset(&self) -> f32
查看源码
max_scroll_offsetpub fn max_scroll_offset(&self) -> f32—

Configures max scroll offset for this part.

pub fn max_scroll_offset(&self) -> f32
查看源码
scroll_bypub fn scroll_by(&mut self, delta: f32) -> bool—

Configures scroll by for this part.

pub fn scroll_by(&mut self, delta: f32) -> bool
查看源码
scroll_topub fn scroll_to(&mut self, offset: f32) -> bool—

Configures scroll to for this part.

pub 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—

Configures visible rows for this part.

pub 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,
查看源码