← Back to Docs
  • index.html
  • Clayground
  • Clayground.Lab
  • PartCard
  • Clayground 2026.7
  • PartCard QML Type

    The selection card: what is selected, what it reads, what you can do to it. More...

    Import Statement: import Clayground.Lab
    Inherits:

    LabPanel

    Properties

    Methods

    Detailed Description

    Follows the selected part on screen (kept inside the window - zoomed in, the anchor can sit far below the viewport). Two lines from the domain (titleOf, readingOf), then the domain's own rows declared as children (a slider, a row of chips), then the rows every board part has: put it on the plot (WatchChip), pin a reading to it as a tag, and a one-line hint.

    The card is also a keyboard target, and the only channel that survives having no pointer: j/\c k walk its rows, h/\c l adjust the focused one, Enter operates the part. Hand keys to LabKeys::selection; a domain row is adjusted through adjust, the kernel rows by the card itself. Declare a CardFocusRing in each domain row bound to focusedRow === "<row>" and every card shares one focus language.

    A part's state belongs on its card - a resistor's ohms are a slider here, a gate's function a row of chips - which is what keeps building and operating from feeling like the same gesture.

    PartCard {
        id: selCard
        board: board; view: view3d; camera: rig.camera; monitor: monitor; overlay: overlay
        flow: root.currentFlow
        titleOf: (p) => root.cardTitle(p)
        readingOf: (p) => root.fmtV(root.simOf(p.id).v)
        adjust: (p, row, d) => root.adjustRow(p, row, d)
        operate: (p) => root.operatePart(p)
        Row { visible: selCard.part !== null && selCard.part.type === "switch"
              CardFocusRing { on: selCard.focusedRow === "state" } }
    }

    See also Board, WatchChip, CardFocusRing, and LabKeys.

    Property Documentation

    adjust : var

    (part, row, d) -> bool - h/\c l on a domain row; false refuses.


    anchorDz : real


    anchorDz \brief How far below the part's centre the card hangs, in world units. : real


    anchorY : real


    attributes : var [read-only]


    attributes \readonly \brief What a tag may show: the monitor's quantity keys. : var [read-only]


    board : Board


    camera : var


    camera \brief The camera the View3D renders with (projection dependency). : var


    flow : var

    The lab's Flow. While one runs, it says whether this card is live.

    A flow selects parts as it explains them, so the card is up through most of a lesson - and a slider that still moves under it is a learner editing the circuit the next sentence quotes a number from. Wired here, the card answers only for a part the running task named (Flow::grants()); otherwise it reads, and a touch on it is refused out loud rather than ignored.


    focusRow : int


    focusRow \brief Which row \c j/\c k landed on. : int


    focusedRow : string [read-only]


    focusedRow \readonly : string [read-only]


    hintOf : var


    hintOf \brief \c {(part) -> string}, the last line. : var


    keys : QtObject [read-only]

    The adapter for LabKeys::selection.


    live : bool [read-only]

    The card's controls act right now.


    minWidthOf : var


    minWidthOf \brief \c {(part) -> real}, a floor for the card's width. : var


    monitor : var


    monitor \brief The \l WatchMonitor the watch row toggles. : var


    operate : var

    (part) -> bool - Enter on the card; false refuses.


    overlay : var


    overlay \brief The \l BoardOverlay the tag row pins into. : var


    part : var [read-only]

    The selected part, live; null when nothing is selected.


    readingOf : var


    readingOf \brief \c {(part) -> string}, the second line; "" hides it. : var


    rows : alias [default]


    rows \brief The domain's rows, stacked between the reading and the watch row. : list<Item> [default]


    titleOf : var


    titleOf \brief \c {(part) -> string}, the first line. : var


    view : var


    view \brief The View3D to project through. : var


    watchable : bool [read-only]


    watchable \readonly \brief The part takes a plot and a tag (spec \c watch). : bool [read-only]


    Method Documentation

    var rowsOf(var part)

    The rows in visual order: the spec's, then "watch" and "label" for a watchable part.