trying to wrap qsettings in rust
This commit is contained in:
parent
137ba3d4f6
commit
f1def0bce9
2 changed files with 58 additions and 0 deletions
34
src/rust/settings.rs
Normal file
34
src/rust/settings.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
#[cxx_qt::bridge]
|
||||
mod settings {
|
||||
|
||||
unsafe extern "C++" {
|
||||
include!("qsettingscxx.h");
|
||||
include!("cxx-qt-lib/qstring.h");
|
||||
type QString = cxx_qt_lib::QString;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[cxx_qt::qobject(base = "QSettingsCXX")]
|
||||
pub struct Settings {
|
||||
#[qproperty]
|
||||
name: QString,
|
||||
#[qproperty]
|
||||
kind: QString,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
name: QString::from(""),
|
||||
kind: QString::from(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl qobject::Settings {
|
||||
#[qinvokable]
|
||||
pub fn activate(self: Pin<&mut Self>) {
|
||||
println!("{}", self.name());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue