diff --git a/qmetaobject/src/qtdeclarative.rs b/qmetaobject/src/qtdeclarative.rs index 41520cb4..e4112302 100644 --- a/qmetaobject/src/qtdeclarative.rs +++ b/qmetaobject/src/qtdeclarative.rs @@ -506,11 +506,7 @@ pub fn qml_register_type( /// /// [qt]: https://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterModule #[cfg(qt_5_9)] -pub fn qml_register_module( - uri: &CStr, - version_major: u32, - version_minor: u32, -) { +pub fn qml_register_module(uri: &CStr, version_major: u32, version_minor: u32) { let uri_ptr = uri.as_ptr(); cpp!(unsafe [ @@ -937,6 +933,18 @@ pub enum QJSValueSpecialValue { } impl QJSValue { + pub fn null() -> Self { + cpp!(unsafe [] -> QJSValue as "QJSValue" { + return QJSValue(QJSValue::SpecialValue::NullValue); + }) + } + + pub fn undefined() -> Self { + cpp!(unsafe [] -> QJSValue as "QJSValue" { + return QJSValue(QJSValue::SpecialValue::UndefinedValue); + }) + } + pub fn is_bool(&self) -> bool { cpp!(unsafe [self as "const QJSValue *"] -> bool as "bool" { return self->isBool();