Fixed Bug in init_from_engine.
Earlier it was registering the KLocalizedContextHolder with a different KLocalizedContext than the context object.
This commit is contained in:
parent
9608434d01
commit
c831f48002
|
@ -2,7 +2,7 @@
|
|||
name = "ki18n"
|
||||
description = "A crate to use KF5I18n from rust."
|
||||
author = ["Ayush Singh <ayushdevel1325@gmail.com>"]
|
||||
version = "1.1.1"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
links = "KF5I18n"
|
||||
license = "MIT"
|
||||
|
|
|
@ -38,9 +38,8 @@ impl KLocalizedContext {
|
|||
pub fn init_from_engine(engine: &QmlEngine) -> Self {
|
||||
let engine_ptr = engine.cpp_ptr();
|
||||
cpp!(unsafe [engine_ptr as "QQmlEngine*"] -> KLocalizedContext as "KLocalizedContextHolder" {
|
||||
auto klocalized = new KLocalizedContext(engine_ptr);
|
||||
auto klocalizedholder = KLocalizedContextHolder(klocalized);
|
||||
engine_ptr->rootContext()->setContextObject(klocalized);
|
||||
auto klocalizedholder = KLocalizedContextHolder(engine_ptr);
|
||||
engine_ptr->rootContext()->setContextObject(klocalizedholder.klocalized.get());
|
||||
return klocalizedholder;
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue