Added klocalizedtranslator.
This commit is contained in:
parent
cba1951df6
commit
a5ca07bad8
28
src/klocalizedtranslator.rs
Normal file
28
src/klocalizedtranslator.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
use cpp::{cpp, cpp_class};
|
||||||
|
|
||||||
|
#[cfg(feature = "qmetaobject")]
|
||||||
|
use qmetaobject::{QObject, QObjectPinned};
|
||||||
|
|
||||||
|
cpp! {{
|
||||||
|
#include <KLocalizedTranslator>
|
||||||
|
|
||||||
|
struct KLocalizedTranslatorHolder {
|
||||||
|
std::unique_ptr<KLocalizedTranslator> translator;
|
||||||
|
|
||||||
|
KLocalizedTranslatorHolder(QObject *parent) : translator(new KLocalizedTranslator(parent)) {}
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
cpp_class!(
|
||||||
|
pub unsafe struct KLocalizedTranslator as "KLocalizedTranslatorHolder"
|
||||||
|
);
|
||||||
|
|
||||||
|
impl KLocalizedTranslator {
|
||||||
|
#[cfg(feature = "qmetaobject")]
|
||||||
|
pub fn new<T: QObject + Sized>(obj: QObjectPinned<T>) -> KLocalizedTranslator {
|
||||||
|
let obj_ptr = obj.get_or_create_cpp_object();
|
||||||
|
cpp!(unsafe [obj_ptr as "QObject *"] -> KLocalizedTranslator as "KLocalizedTranslatorHolder" {
|
||||||
|
return KLocalizedTranslatorHolder(obj_ptr);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
pub mod klocalizedcontext;
|
pub mod klocalizedcontext;
|
||||||
pub mod klocalizedstring;
|
pub mod klocalizedstring;
|
||||||
|
pub mod klocalizedtranslator;
|
||||||
// pub mod kcountry;
|
// pub mod kcountry;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
|
|
Loading…
Reference in a new issue