Preparing search index...

    Individual item in a ListWidget.

    export class ListWidgetItemPanel extends PanelPlugin {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.UiListWidgetItemExample';
    d.name = 'ListWidgetItem Example';
    d.defaultDockState = DockState.Detached;
    d.defaultSize = new Size(350, 300);
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    createWidget(parent: Widget): Widget {
    const root = new Widget(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    layout.spacing = 8;
    root.layout = layout;

    const title = new Label(root);
    title.text = 'ListWidget + ListWidgetItem';
    title.fontRole = FontRole.TitleBold;
    layout.addWidget(title);

    const list = new ListWidget(root);
    layout.addWidget(list);

    // Create items with text and properties
    const items = ['Camera', 'Light', 'Mesh'];
    for (static i = 0; i < items.length; i++) {
    const item = new ListWidgetItem(list);
    item.text = items[i];
    item.sizeHint = new Size(200, 30);
    list.addItem(item);
    }
    list.setCurrentRow(0);

    const status = new Label(root);
    status.text = 'Selected: Camera';
    layout.addWidget(status);

    this.connections.push(
    list.onCurrentRowChanged.connect((row: number) => {
    status.text = 'Selected: ' + items[row];
    })
    );

    return root;
    }
    deinit(): void {
    this.connections.forEach((c: any) => c?.disconnect());
    this.connections = [];
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    hidden: boolean

    Whether the list item is hidden from display.

    selected: boolean

    Whether the list item is currently selected.

    sizeHint: Size

    Suggested dimensions for rendering the list item.

    text: string

    The text label displayed for the list item.

    Methods

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean

    • Sets the icon displayed for this list item.

      Parameters

      Returns void