qslot

Attribute Macro qslot 

Source
#[qslot]
Expand description

Annotates a function as invokable from QML.

In addition to being invokable from QML, the function can also act as a slot for signal-slot connections when used in Qt signal bindings.

§Requirements

  • Has to be defined within a mod or impl block, annotated with qobject or qobject_impl, respectively.
  • The annotated function must have a body.
  • The first argument of the annotated function must be &self or &mut self.
  • All other types and the return type must be in the list of supported types.

§Example

#[qslot]
fn set_value(&mut self, new_value: i32) {
    self.value = new_value;
}

§Parameters

qml_name

The function name as seen from QML. Defaults to the Rust function name.