Skip to content

fontlabapp.qt.trees.draft.DraftTree · declarations 001

Back to fontlabapp.qt.trees.draft.DraftTree

__init__

__init__(source: Tree) -> None

cells

cells(identity: int) -> tuple[object, ...]

Return an immutable copy of row cells, or headers for the root.

children

children(identity: int) -> tuple[int, ...]

Return immediate children in visible row order.

column_count property

column_count: int

Return global column count, which may be zero after removal.

fork

fork() -> DraftTree

Copy containers for complete edit preflight before Qt notifications.

Opaque cell values retain their identity; they are never deep-copied or executed. Changing either copy's cells/structure leaves the other alone.

identities

identities() -> tuple[int, ...]

Return all live IDs, root first, in allocation order.

insert_columns

insert_columns(position: int, count: int, header: str = 'Column') -> None

Insert global columns while preserving hierarchy and node IDs.

insert_rows

insert_rows(parent: int, position: int, count: int, cells: tuple[str, ...]) -> tuple[int, ...]

Insert independent equal rows; return their fresh occurrence IDs.

parent

parent(identity: int) -> int | None

Return the parent ID; only root has no parent.

position

position(identity: int) -> int

Return the current sibling position, refusing the invisible root.

remove_columns

remove_columns(position: int, count: int) -> None

Remove global columns; callers choose whether to drop empty rows.

remove_rows

remove_rows(parent: int, position: int, count: int) -> tuple[int, ...]

Remove rows and complete descendant subtrees without recursion.

set_cell

set_cell(identity: int, column: int, value: str) -> None

Set one text cell or header; no data coercion hides invalid values.

set_value

set_value(identity: int, column: int, value: object) -> None

Retain an edited QVariant value for the official example's policy.

This explicit boundary preserves None, numeric and Qt value objects; set_cell remains the strict text API. Values are stored by reference, as in the original item model. No conversion or host access occurs.