This commit is contained in:
doryan 2024-08-12 23:49:40 +04:00
parent 24b60e74a0
commit 269b30312d

View File

@ -21,10 +21,11 @@ extern crate gio;
use gio::ListStore;
use gtk::{
prelude::{BoxExt, ButtonExt, Cast, CastNone, GridExt, ListItemExt, ListModelExt, SorterExt},
prelude::{BoxExt, ButtonExt, Cast, CastNone, GridExt, ListItemExt, SorterExt},
Align, WrapMode, *,
};
use gtk4 as gtk;
use prelude::ListModelExt;
pub fn signal_reducing_page(wrapper: &Box) {
let values = Rc::new(Cell::new(SignalReduce::default()));
@ -68,6 +69,7 @@ pub fn signal_reducing_page(wrapper: &Box) {
let result_table_headers_labels: [&str; 4] = ["f, МГц", "Xc, Ом", "Vп, мВ", "ζ"];
let model = ListStore::new::<Frequency>();
let model_for_events = model.clone();
for number in (0..=100).step_by(5) {
@ -98,13 +100,12 @@ pub fn signal_reducing_page(wrapper: &Box) {
result_table.connect_activate(clone!(
#[strong]
numeric_sorter,
move |_, _| {
numeric_sorter.changed(SorterChange::Different);
}
move |_, _| numeric_sorter.changed(SorterChange::Different)
));
for label in result_table_headers_labels {
let factory = SignalListItemFactory::new();
let values_for_factory = values.clone();
factory.connect_setup(move |_, list_item| {
list_item
@ -113,8 +114,6 @@ pub fn signal_reducing_page(wrapper: &Box) {
.set_child(Some(&Label::new(None)));
});
let values_for_factory = values.clone();
factory.connect_bind(move |_, list_item| {
let cell_value = list_item
.downcast_ref::<ListItem>()
@ -211,9 +210,10 @@ pub fn signal_reducing_page(wrapper: &Box) {
}
None => {
model_for_events.append(&Frequency::new(values.get().frequency));
let a = model_for_events.n_items();
model_for_events.items_changed(0, 0, 1);
model_for_events.items_changed(1, 1, 0);
model_for_events.items_changed(0, 0, a - 1);
model_for_events.items_changed(a - 1, a - 1, 0);
}
}
}