mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Error out when selecting unknown styles
This commit is contained in:
parent
f9fd523583
commit
d64dfa500c
3 changed files with 33 additions and 1 deletions
|
@ -22,6 +22,10 @@ impl<'a> VirtualFile<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn styles() -> Vec<&'static str> {
|
||||
builtin_library::styles()
|
||||
}
|
||||
|
||||
pub fn load_file<'a>(path: &'a std::path::Path) -> Option<VirtualFile<'static>> {
|
||||
match path.strip_prefix("builtin:/") {
|
||||
Ok(builtin_path) => builtin_library::load_builtin_file(builtin_path),
|
||||
|
@ -44,6 +48,20 @@ mod builtin_library {
|
|||
|
||||
use super::VirtualFile;
|
||||
|
||||
pub(crate) fn styles() -> Vec<&'static str> {
|
||||
widget_library()
|
||||
.iter()
|
||||
.filter_map(|d| {
|
||||
let style = d.0;
|
||||
if d.1.iter().any(|f| f.path == "sixtyfps_widgets.60") {
|
||||
Some(style)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn load_builtin_file(
|
||||
builtin_path: &std::path::Path,
|
||||
) -> Option<VirtualFile<'static>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue