-
import { VideoCompress } from "pages/video_compress.slint";
import { Button, VerticalBox , ListView, StandardListView, HorizontalBox, StandardButton, ComboBox, ProgressIndicator} from "std-widgets.slint";
export component AppWindow inherits Window {
title: "Dali";
callback choose_video_file();
callback compress_video();
in-out property <float> compressing_progress_value: 0;
in property <bool> compress-enabled: false;
in property <string> compress_video_input_file_path: "None" ;
out property <string> video-type: v_c.video-type;
HorizontalBox {
side_bar := StandardListView {
horizontal-stretch: 0;
width: 100px;
current-item: 0;
model: [ {
text: "视频压缩",
}];
}
if side_bar.current-item == 0 :
v_c := VideoCompress {
choose_video_file => {choose_video_file()}
compress_video => {compress_video()}
compressing_progress_value: compressing_progress_value;
compress_enabled: compress-enabled;
input_file_path: compress_video_input_file_path;
}
}
} My sidebar has a number of optional pages and I don't always choose which one, when I wanted to pass a v_c.video-type to mian.rs I tried a couple of ways the way I wanted to do it and realized I couldn't do it by myself, is there a standard way to do it and is the way I'm passing the variable very unscientific? video_compress.slint import { Button, VerticalBox , ListView, StandardListView, HorizontalBox, StandardButton, ComboBox, ProgressIndicator, StandardTableView} from "std-widgets.slint";
export component VideoCompress inherits VerticalBox {
callback choose_video_file();
callback compress_video();
in-out property <float> compressing_progress_value;
in property <bool> compress_enabled;
in property <string> input_file_path;
out property <string> video_type <=> type-cbx.current-value;
Button {
text: "选择文件";
clicked => {
choose_video_file();
}
}
if (input-file-path != "None") : Text {
text: "已选择文件:\n\{input_file_path}";
}
HorizontalBox {
Text {
text: "输出格式:";
}
type_cbx := ComboBox {
height: 20px;
width: 70px;
model: ["mp4", "avi", "mov"];
}
}
Button {
text: "开始压缩";
enabled: compress_enabled;
clicked => {
compress_video();
}
}
ProgressIndicator {
progress: compressing_progress_value;
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Oct 26, 2023
Replies: 1 comment 3 replies
-
What you can do is use two way binding in the inner component like so:
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
LeeeSe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What you can do is use two way binding in the inner component like so: