Skip to main content

Module setup

Module setup 

Source
Expand description

Simplified setup helpers for NodeEditor with globals architecture.

The NodeEditorSetup provides automatic callback handling. You only need to provide a closure that commits a finished drag into your model.

§Generated-UI integration

This fragment uses the generated types and model from the compiled quick start.

use slint_node_editor::{GraphLogic, NodeEditorSetup, wire_node_editor};

slint::include_modules!();

fn main() {
    let window = MainWindow::new().unwrap();

    let setup = NodeEditorSetup::new({
        let nodes = nodes.clone();
        move |dragged, delta_x, delta_y| {
            GraphLogic::commit_drag(&nodes, dragged, delta_x, delta_y);
        }
    });

    wire_node_editor!(window, setup);
    window.run().unwrap();
}

Structs§

NodeEditorSetup
Setup helper that bundles NodeEditorController and automatic model updates.