Skip to content

Commit

Permalink
Update qtdeclarative.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
IriaSomobu authored and ogoffart committed Oct 12, 2023
1 parent e51964d commit 9d43036
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions qmetaobject/src/qtdeclarative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ impl QmlEngine {
})
}

pub fn invoke_method_noreturn(&mut self, name: QByteArray, args: &[QVariant]) -> QVariant {
/// This method is the same as [invoke_method] but does not capture or return function's return value
pub fn invoke_method_noreturn(&mut self, name: QByteArray, args: &[QVariant]) {
let args_size = args.len();
let args_ptr = args.as_ptr();

Expand All @@ -242,13 +243,12 @@ impl QmlEngine {
name as "QByteArray",
args_size as "size_t",
args_ptr as "QVariant *"
] -> QVariant as "QVariant"
{
] {
auto robjs = self->engine->rootObjects();
if (robjs.isEmpty()) {
return {};
return;
}
QVariant ret;

#define INVOKE_METHOD(...) QMetaObject::invokeMethod(robjs.first(), name __VA_ARGS__);
switch (args_size) {
case 0: INVOKE_METHOD(); break;
Expand All @@ -263,7 +263,6 @@ impl QmlEngine {
case 9: INVOKE_METHOD(, Q_ARG(QVariant, args_ptr[0]), Q_ARG(QVariant, args_ptr[1]), Q_ARG(QVariant, args_ptr[2]), Q_ARG(QVariant, args_ptr[3]), Q_ARG(QVariant, args_ptr[4]), Q_ARG(QVariant, args_ptr[5]), Q_ARG(QVariant, args_ptr[6]), Q_ARG(QVariant, args_ptr[7]), Q_ARG(QVariant, args_ptr[8])); break;
}
#undef INVOKE_METHOD
return ret;
})
}

Expand Down

0 comments on commit 9d43036

Please sign in to comment.