Expand description
Shared capability types for the data-source drag-and-drop + lazy protocol.
These types are the Teksilo-shaped equivalent of Qt’s
flags/canDropMimeData/dropMimeData (DnD validation) and
canFetchMore/fetchMore (lazy loading), expressed as defaulted methods on
ListDataSource and
TreeDataSource. A source owns the answer to
“may this drop happen?” (can_accept) and “apply the move” (accept_drop);
the view merely renders the source’s verdict and routes the commit. This is
what lets an external source of truth (e.g. a Qleany entity store) drive a
view without the view ever mutating a mirror model.
§Key types
ItemKey— blanket identity trait for anyClone + Eq + Hash + Debug + 'statictype.RowState— whether a lazy row’s data is resident (Ready) or still loading (Loading).DragEligibility— per-row drag gate returned byListDataSource::drag.DropPosition— where a drop lands relative to the target row.DragSource— who is dragging: the same view (intra-view reorder) or a foreign view/OS drop.DropQuery/DropResponse— hover-time can-I-drop? query and verdict.DropCommit— the committed drop handed toaccept_drop.
ⓘ
// Example: implementing can_accept for a custom ListDataSource
fn can_accept(&self, query: &teksilo_data::DropQuery<'_, usize>) -> teksilo_data::DropResponse {
match &query.source {
teksilo_data::DragSource::SameView { .. } => teksilo_data::DropResponse::Accept,
teksilo_data::DragSource::Foreign { .. } => teksilo_data::DropResponse::Reject,
}
}Structs§
- Drop
Commit - A drop the user actually committed, handed to
accept_dropto apply. - Drop
Query - A hover-time question posed to a source: “may
sourcedrop atpositionrelative totarget?” The source answers with aDropResponse.
Enums§
- Drag
Eligibility - Whether a row may begin a drag at all (the per-item transferable gate, Qt’s
Qt::ItemIsDragEnabled/TabBar’swith_transferable_predicate). - Drag
Source - Who is dragging, from the receiving source’s point of view.
- Drop
Position - Where, relative to a target row, a drop lands.
Into(reparent) is only meaningful for trees; flat lists reject it. - Drop
Response - A source’s verdict on a
DropQuery. Drives the hover affordance and gates the commit. - RowState
- Whether a realized row’s data is resident yet. A windowed/lazy source returns
Loadingfor indices outside its resident window; the view renders a placeholder skeleton for those and callsrequest_windowto pull them.
Traits§
- ItemKey
- A stable, hashable identity for a row/node. Blanket-implemented for every
Clone + Eq + Hash + Debug + 'statictype, sousize,NodeId,i64,String,Uuid, … all qualify with no extra work.