some testing of file_helper.rs
This commit is contained in:
parent
8b4c348279
commit
e6d480d678
1 changed files with 12 additions and 4 deletions
|
@ -1,11 +1,14 @@
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
mod file_helper {
|
mod file_helper {
|
||||||
use cxx::{CxxString, CxxVector};
|
use cxx_qt_lib::QVariantValue;
|
||||||
|
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!("cxx-qt-lib/qstring.h");
|
include!("cxx-qt-lib/qstring.h");
|
||||||
type QString = cxx_qt_lib::QString;
|
type QString = cxx_qt_lib::QString;
|
||||||
include!("cxx-qt-lib/qurl.h");
|
include!("cxx-qt-lib/qurl.h");
|
||||||
type QUrl = cxx_qt_lib::QUrl;
|
type QUrl = cxx_qt_lib::QUrl;
|
||||||
|
include!("cxx-qt-lib/qdate.h");
|
||||||
|
type QDate = cxx_qt_lib::QDate;
|
||||||
include!("cxx-qt-lib/qvariant.h");
|
include!("cxx-qt-lib/qvariant.h");
|
||||||
type QVariant = cxx_qt_lib::QVariant;
|
type QVariant = cxx_qt_lib::QVariant;
|
||||||
}
|
}
|
||||||
|
@ -30,16 +33,21 @@ mod file_helper {
|
||||||
|
|
||||||
impl qobject::FileHelper {
|
impl qobject::FileHelper {
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
pub fn save(self: Pin<&mut Self>, file: QUrl, _service_list: QVariant) -> bool {
|
pub fn save(self: Pin<&mut Self>, file: QUrl, service_list: QVariant) -> bool {
|
||||||
println!("{}", file);
|
println!("{}", file);
|
||||||
|
match service_list.value() {
|
||||||
|
QVariantValue::QString(..) => println!("string"),
|
||||||
|
QVariantValue::QUrl(..) => println!("url"),
|
||||||
|
QVariantValue::QDate(..) => println!("date"),
|
||||||
|
_ => println!("QVariant is..."),
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
pub fn load(self: Pin<&mut Self>, file: QUrl) -> Vec<String> {
|
pub fn load(self: Pin<&mut Self>, file: QUrl) -> Vec<String> {
|
||||||
println!("{}", file);
|
println!("{}", file);
|
||||||
let vc = vec![String::new()];
|
return vec!["hi".to_string()];
|
||||||
return vc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue