#[qslot]Expand description
Annotates a function as invokable from QML.
Such a function is also registered as a Qt slot, so it can be the target of a
signal-slot connection, or be
invoked by name from Rust through a QmlMethodInvoker.
§Requirements
- Has to be defined within a
modorimplblock, annotated withqobject. - The annotated function must have a body.
- The first argument of the annotated function must be
&selfor&mut self. - All other parameter types and the return type must implement
QMetaCallArg.
§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.