Trying out qmetaobject-rs method for docs.

This commit is contained in:
Ayush Singh 2021-11-13 09:42:03 +05:30
parent ce6adf77ca
commit b8f1cbaed7
2 changed files with 22 additions and 3 deletions

View file

@ -39,10 +39,29 @@
//! engine.exec();
//! }
//! ```
use qmetaobject::prelude::*;
use std::ffi::c_void;
#[cfg(not(no_qt))]
use cpp::{cpp, cpp_class};
use qmetaobject::prelude::*;
#[cfg(no_qt)]
mod no_qt {
pub fn panic<T>() -> T {
panic!("This example is not supported on Qt 6 and above")
}
}
#[cfg(no_qt)]
macro_rules! cpp {
{{ $($t:tt)* }} => {};
{$(unsafe)? [$($a:tt)*] -> $ret:ty as $b:tt { $($t:tt)* } } => {
crate::no_qt::panic::<$ret>()
};
{ $($t:tt)* } => {
crate::no_qt::panic::<()>()
};
}
cpp! {{
#include <KLocalizedContext>