本文へスキップ

Table

ヘッダー、行、セルのパーツを持つ仮想化テーブルコレクションです。

デモを読み込み中…

#インポート

quickgui から Table をインポートします。

use quickgui::*;

#使い方

TableState::new(rows, columns)
    .element("issues")

#構成

  • Table::root
  • Table::header
  • Table::row
  • Table::cell_part

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

pub fn new(row_count: usize) -> Self
with_selection_modepub fn with_selection_mode(mut self, mode: TableSelectionMode) -> Self—

Allow Shift ranges, platform-modified toggles, and Select All.

pub fn with_selection_mode(mut self, mode: TableSelectionMode) -> Self
ソースを見る
with_layoutpub fn with_layout(mut self, layout: TableLayout) -> Self—

Configures with layout for this part.

pub fn with_layout(mut self, layout: TableLayout) -> Self
ソースを見る
layoutpub const fn layout(&self) -> TableLayout—

Configures layout for this part.

pub const fn layout(&self) -> TableLayout
ソースを見る
set_layoutpub fn set_layout(&mut self, layout: TableLayout) -> bool—

Configures set layout for this part.

pub fn set_layout(&mut self, layout: TableLayout) -> bool
ソースを見る
row_countpub const fn row_count(&self) -> usize—

Configures row count for this part.

pub const fn row_count(&self) -> usize
ソースを見る
set_row_countpub fn set_row_count(&mut self, row_count: usize) -> bool—

Configures set row count for this part.

pub fn set_row_count(&mut self, row_count: usize) -> bool
ソースを見る
selection_modepub const fn selection_mode(&self) -> TableSelectionMode—

Configures selection mode for this part.

pub const fn selection_mode(&self) -> TableSelectionMode
ソースを見る
set_selection_modepub fn set_selection_mode(&mut self, mode: TableSelectionMode) -> bool—

Configures set selection mode for this part.

pub fn set_selection_mode(&mut self, mode: TableSelectionMode) -> bool
ソースを見る
selectionpub const fn selection(&self) -> &TableSelection—

The retained row selection.

pub const fn selection(&self) -> &TableSelection
ソースを見る
selection_versionpub const fn selection_version(&self) -> u64—

A counter bumped once every time the retained selection actually changes. Comparing this across a frame is cheaper than cloning the selection, and it is what the table itself uses to decide whether to dispatch [`TableSelectionChanged`].

pub const fn selection_version(&self) -> u64
ソースを見る
set_selectionpub fn set_selection(&mut self, selection: TableSelection) -> bool—

Replace the retained row selection, dropping rows past the current row count.

pub fn set_selection(&mut self, selection: TableSelection) -> bool
ソースを見る
selection_anchorpub const fn selection_anchor(&self) -> Option<usize>—

The row a Shift range extends from.

pub const fn selection_anchor(&self) -> Option<usize>
ソースを見る
is_row_selectedpub fn is_row_selected(&self, row: usize) -> bool—

Configures is row selected for this part.

pub fn is_row_selected(&self, row: usize) -> bool
ソースを見る
select_rowpub fn select_row(&mut self, row: usize) -> bool—

Select exactly one row and anchor future Shift ranges there.

pub fn select_row(&mut self, row: usize) -> bool
ソースを見る
toggle_row_selectionpub fn toggle_row_selection(&mut self, row: usize) -> bool—

Add or remove one row from a multiple selection. A single-selection table selects the row instead of toggling it, so the platform-modified click of a single-selection list behaves like an ordinary click.

pub fn toggle_row_selection(&mut self, row: usize) -> bool
ソースを見る
select_row_rangepub fn select_row_range(&mut self, row: usize) -> bool—

Replace the selection with the range between the anchor and `row`.

pub fn select_row_range(&mut self, row: usize) -> bool
ソースを見る
select_all_rowspub fn select_all_rows(&mut self) -> bool—

Select every row. A single-selection table refuses.

pub fn select_all_rows(&mut self) -> bool
ソースを見る
clear_row_selectionpub fn clear_row_selection(&mut self) -> bool—

Configures clear row selection for this part.

pub fn clear_row_selection(&mut self) -> bool
ソースを見る
editing_cellpub const fn editing_cell(&self) -> Option<TableCellPosition>—

The open inline editor, if any.

pub const fn editing_cell(&self) -> Option<TableCellPosition>
ソースを見る
begin_editpub fn begin_edit(&mut self, position: TableCellPosition, column_count: usize) -> bool—

Open an inline editor over one cell and make it the active cell. The application owns the editor element and its draft value; QuickGUI retains only which cell is being edited, gives that cell its own key context, and reports Return and Escape.

pub fn begin_edit(&mut self, position: TableCellPosition, column_count: usize) -> bool
ソースを見る
end_editpub fn end_edit(&mut self) -> Option<TableCellPosition>—

Close the open editor. Returns the cell that was being edited.

pub fn end_edit(&mut self) -> Option<TableCellPosition>
ソースを見る
column_widthpub fn column_width(&self, column: ElementId) -> Option<f32>—

The retained width of a resizable column.

pub fn column_width(&self, column: ElementId) -> Option<f32>
ソースを見る
set_column_widthpub fn set_column_width(&mut self, column: ElementId, width: f32) -> bool—

Replace one resizable column's width, clamped to its declared minimum and the table's maximum. A column that is not resizable is ignored.

pub fn set_column_width(&mut self, column: ElementId, width: f32) -> bool
ソースを見る
resize_columnpub fn resize_column(&mut self, column: ElementId, delta: f32) -> bool—

Move one resizable column's trailing edge by a logical-pixel delta.

pub fn resize_column(&mut self, column: ElementId, delta: f32) -> bool
ソースを見る
column_orderpub fn column_order(&self) -> &[u16]—

The declared column indices in their current display order.

pub fn column_order(&self) -> &[u16]
ソースを見る
move_columnpub fn move_column(&mut self, column_index: usize, delta: isize) -> bool—

Move one declared column to a different position in the display order.

pub fn move_column(&mut self, column_index: usize, delta: isize) -> bool
ソースを見る
selected_cellpub const fn selected_cell(&self) -> Option<TableCellPosition>—

Configures selected cell for this part.

pub const fn selected_cell(&self) -> Option<TableCellPosition>
ソースを見る
selected_rowpub fn selected_row(&self) -> Option<usize>—

Configures selected row for this part.

pub fn selected_row(&self) -> Option<usize>
ソースを見る
sortpub const fn sort(&self) -> Option<TableSort>—

Configures sort for this part.

pub const fn sort(&self) -> Option<TableSort>
ソースを見る
set_sortpub fn set_sort(&mut self, sort: Option<TableSort>) -> bool—

Configures set sort for this part.

pub fn set_sort(&mut self, sort: Option<TableSort>) -> bool
ソースを見る
clear_selectionpub fn clear_selection(&mut self) -> bool—

Configures clear selection for this part.

pub fn clear_selection(&mut self) -> bool
ソースを見る
select_cellpub fn select_cell(&mut self, position: TableCellPosition, column_count: usize) -> bool—

Make one cell active and collapse the row selection onto its row. This is the unmodified click and arrow-key behavior of every desktop list. Use [`Self::set_selection`] or [`Self::toggle_row_selection`] to change selection without moving the active cell.

pub fn select_cell(&mut self, position: TableCellPosition, column_count: usize) -> bool
ソースを見る
visible_rowspub fn visible_rows(&self) -> std::ops::Range<usize>—

Configures visible rows for this part.

pub fn visible_rows(&self) -> std::ops::Range<usize>
ソースを見る
list_statepub fn list_state(&self) -> &ListState—

Configures list state for this part.

pub fn list_state(&self) -> &ListState
ソースを見る
focus_handlepub fn focus_handle(id: impl Into<ElementId>) -> FocusHandle—

Configures focus handle for this part.

pub fn focus_handle(id: impl Into<ElementId>) -> FocusHandle
ソースを見る
row_idpub fn row_id(id: impl Into<ElementId>, row: usize) -> ElementId—

Configures row id for this part.

pub fn row_id(id: impl Into<ElementId>, row: usize) -> ElementId
ソースを見る
cell_idpub fn cell_id(id: impl Into<ElementId>, position: TableCellPosition) -> ElementId—

Configures cell id for this part.

pub fn cell_id(id: impl Into<ElementId>, position: TableCellPosition) -> ElementId
ソースを見る
column_header_idpub fn column_header_id(id: impl Into<ElementId>, column: ElementId) -> ElementId—

Configures column header id for this part.

pub fn column_header_id(id: impl Into<ElementId>, column: ElementId) -> ElementId
ソースを見る
resize_handle_idpub fn resize_handle_id(id: impl Into<ElementId>, column: ElementId) -> ElementId—

The stable identity of one column's resize handle.

pub fn resize_handle_id(id: impl Into<ElementId>, column: ElementId) -> ElementId
ソースを見る

TableState::element

ソースを見る
pub fn element<V, H, E, RenderHeader, RenderCell, Activate>( &mut self, cx: &mut ViewContext<'_, V>, id: impl Into<ElementId>, columns: &[TableColumn], access: fn(&mut V) -> &mut TableState, render_header: RenderHeader, render_cell: RenderCell, activate: Activate, ) -> Element where V: 'static, H: IntoElement, E: IntoElement, RenderHeader: FnMut(TableHeaderState<'_>) -> H, RenderCell: FnMut(TableCellState<'_>) -> E, Activate: Fn(&mut V, TableCellPosition, &mut EventContext) + Clone + 'static,

Build a complete unstyled virtualized, sortable, keyboard-navigable table. `render_header` owns every visible header declaration, including label, sort indicator, and the placement of the resize handle QuickGUI hands it. `render_cell` owns every visible cell declaration, including the inline editor it mounts while `editing` is set, and runs only for mounted rows. QuickGUI decorates those elements with fixed grid geometry, identities, pointer/keyboard behavior, and accessibility semantics but adds no paint. `activate` receives the current logical cell when Return is dispatched outside an editor; selection, sort, width, order, and editing state remain directly readable from `access`.

TableState::element_with

ソースを見る
pub fn element_with<V, H, E, RenderHeader, RenderCell, Activate>( &mut self, cx: &mut ViewContext<'_, V>, id: impl Into<ElementId>, columns: &[TableColumn], access_source: StateAccessor<V, TableState>, render_header: RenderHeader, render_cell: RenderCell, activate: Activate, ) -> Element where V: 'static, H: IntoElement, E: IntoElement, RenderHeader: FnMut(TableHeaderState<'_>) -> H, RenderCell: FnMut(TableCellState<'_>) -> E, Activate: Fn(&mut V, TableCellPosition, &mut EventContext) + Clone + 'static,

Build the table against a per-instance retained-state accessor. A host that renders many declared tables through one view passes an accessor that captures which [`TableState`] each registered listener resolves. Every row is a plain container; [`Self::element_with_rows`] lets the caller paint the rows too.

TableState::element_with_rows

ソースを見る
pub fn element_with_rows<V, R, H, E, RenderRow, RenderHeader, RenderCell, Activate>( &mut self, cx: &mut ViewContext<'_, V>, id: impl Into<ElementId>, columns: &[TableColumn], access_source: StateAccessor<V, TableState>, mut render_row: RenderRow, mut render_header: RenderHeader, mut render_cell: RenderCell, activate: Activate, ) -> Element where V: 'static, R: IntoElement, H: IntoElement, E: IntoElement, RenderRow: FnMut(TableRowState) -> R, RenderHeader: FnMut(TableHeaderState<'_>) -> H, RenderCell: FnMut(TableCellState<'_>) -> E, Activate: Fn(&mut V, TableCellPosition, &mut EventContext) + Clone + 'static,

Build the table with a caller-owned container for every mounted row. `render_row` returns the element a row's cells are laid out in. QuickGUI adds the grid tracks, the row height, the row identity, and the collection semantics on top of it, so the caller declares only the row's paint — a background, a divider, a hover state, or a [`selected_style`](Element::selected_style) that paints while the row is selected — never its layout. The renderer runs only for mounted rows.