diff --git a/demo/rust/src/interface.rs b/demo/rust/src/interface.rs index 301ee51..230ce0b 100644 --- a/demo/rust/src/interface.rs +++ b/demo/rust/src/interface.rs @@ -137,6 +137,8 @@ pub extern "C" fn demo_new( fibonacci_result_changed: fn(*const FibonacciQObject), fibonacci_list: *mut FibonacciListQObject, fibonacci_list_new_data_ready: fn(*const FibonacciListQObject), + fibonacci_list_layout_about_to_be_changed: fn(*const FibonacciListQObject), + fibonacci_list_layout_changed: fn(*const FibonacciListQObject), fibonacci_list_data_changed: fn(*const FibonacciListQObject, usize, usize), fibonacci_list_begin_reset_model: fn(*const FibonacciListQObject), fibonacci_list_end_reset_model: fn(*const FibonacciListQObject), @@ -149,6 +151,8 @@ pub extern "C" fn demo_new( file_system_tree: *mut FileSystemTreeQObject, file_system_tree_path_changed: fn(*const FileSystemTreeQObject), file_system_tree_new_data_ready: fn(*const FileSystemTreeQObject, index: COption), + file_system_tree_layout_about_to_be_changed: fn(*const FileSystemTreeQObject), + file_system_tree_layout_changed: fn(*const FileSystemTreeQObject), file_system_tree_data_changed: fn(*const FileSystemTreeQObject, usize, usize), file_system_tree_begin_reset_model: fn(*const FileSystemTreeQObject), file_system_tree_end_reset_model: fn(*const FileSystemTreeQObject), @@ -161,6 +165,8 @@ pub extern "C" fn demo_new( processes: *mut ProcessesQObject, processes_active_changed: fn(*const ProcessesQObject), processes_new_data_ready: fn(*const ProcessesQObject, index: COption), + processes_layout_about_to_be_changed: fn(*const ProcessesQObject), + processes_layout_changed: fn(*const ProcessesQObject), processes_data_changed: fn(*const ProcessesQObject, usize, usize), processes_begin_reset_model: fn(*const ProcessesQObject), processes_end_reset_model: fn(*const ProcessesQObject), @@ -172,6 +178,8 @@ pub extern "C" fn demo_new( processes_end_remove_rows: fn(*const ProcessesQObject), time_series: *mut TimeSeriesQObject, time_series_new_data_ready: fn(*const TimeSeriesQObject), + time_series_layout_about_to_be_changed: fn(*const TimeSeriesQObject), + time_series_layout_changed: fn(*const TimeSeriesQObject), time_series_data_changed: fn(*const TimeSeriesQObject, usize, usize), time_series_begin_reset_model: fn(*const TimeSeriesQObject), time_series_end_reset_model: fn(*const TimeSeriesQObject), @@ -194,6 +202,8 @@ pub extern "C" fn demo_new( }; let model = FibonacciListList { qobject: fibonacci_list, + layout_about_to_be_changed: fibonacci_list_layout_about_to_be_changed, + layout_changed: fibonacci_list_layout_changed, data_changed: fibonacci_list_data_changed, begin_reset_model: fibonacci_list_begin_reset_model, end_reset_model: fibonacci_list_end_reset_model, @@ -212,6 +222,8 @@ pub extern "C" fn demo_new( }; let model = FileSystemTreeTree { qobject: file_system_tree, + layout_about_to_be_changed: file_system_tree_layout_about_to_be_changed, + layout_changed: file_system_tree_layout_changed, data_changed: file_system_tree_data_changed, begin_reset_model: file_system_tree_begin_reset_model, end_reset_model: file_system_tree_end_reset_model, @@ -230,6 +242,8 @@ pub extern "C" fn demo_new( }; let model = ProcessesTree { qobject: processes, + layout_about_to_be_changed: processes_layout_about_to_be_changed, + layout_changed: processes_layout_changed, data_changed: processes_data_changed, begin_reset_model: processes_begin_reset_model, end_reset_model: processes_end_reset_model, @@ -247,6 +261,8 @@ pub extern "C" fn demo_new( }; let model = TimeSeriesList { qobject: time_series, + layout_about_to_be_changed: time_series_layout_about_to_be_changed, + layout_changed: time_series_layout_changed, data_changed: time_series_data_changed, begin_reset_model: time_series_begin_reset_model, end_reset_model: time_series_end_reset_model, @@ -396,6 +412,8 @@ impl FibonacciListEmitter { pub struct FibonacciListList { qobject: *const FibonacciListQObject, + layout_about_to_be_changed: fn(*const FibonacciListQObject), + layout_changed: fn(*const FibonacciListQObject), data_changed: fn(*const FibonacciListQObject, usize, usize), begin_reset_model: fn(*const FibonacciListQObject), end_reset_model: fn(*const FibonacciListQObject), @@ -408,6 +426,12 @@ pub struct FibonacciListList { } impl FibonacciListList { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -456,6 +480,8 @@ pub trait FibonacciListTrait { pub extern "C" fn fibonacci_list_new( fibonacci_list: *mut FibonacciListQObject, fibonacci_list_new_data_ready: fn(*const FibonacciListQObject), + fibonacci_list_layout_about_to_be_changed: fn(*const FibonacciListQObject), + fibonacci_list_layout_changed: fn(*const FibonacciListQObject), fibonacci_list_data_changed: fn(*const FibonacciListQObject, usize, usize), fibonacci_list_begin_reset_model: fn(*const FibonacciListQObject), fibonacci_list_end_reset_model: fn(*const FibonacciListQObject), @@ -472,6 +498,8 @@ pub extern "C" fn fibonacci_list_new( }; let model = FibonacciListList { qobject: fibonacci_list, + layout_about_to_be_changed: fibonacci_list_layout_about_to_be_changed, + layout_changed: fibonacci_list_layout_changed, data_changed: fibonacci_list_data_changed, begin_reset_model: fibonacci_list_begin_reset_model, end_reset_model: fibonacci_list_end_reset_model, @@ -563,6 +591,8 @@ impl FileSystemTreeEmitter { pub struct FileSystemTreeTree { qobject: *const FileSystemTreeQObject, + layout_about_to_be_changed: fn(*const FileSystemTreeQObject), + layout_changed: fn(*const FileSystemTreeQObject), data_changed: fn(*const FileSystemTreeQObject, usize, usize), begin_reset_model: fn(*const FileSystemTreeQObject), end_reset_model: fn(*const FileSystemTreeQObject), @@ -575,6 +605,12 @@ pub struct FileSystemTreeTree { } impl FileSystemTreeTree { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -631,6 +667,8 @@ pub extern "C" fn file_system_tree_new( file_system_tree: *mut FileSystemTreeQObject, file_system_tree_path_changed: fn(*const FileSystemTreeQObject), file_system_tree_new_data_ready: fn(*const FileSystemTreeQObject, index: COption), + file_system_tree_layout_about_to_be_changed: fn(*const FileSystemTreeQObject), + file_system_tree_layout_changed: fn(*const FileSystemTreeQObject), file_system_tree_data_changed: fn(*const FileSystemTreeQObject, usize, usize), file_system_tree_begin_reset_model: fn(*const FileSystemTreeQObject), file_system_tree_end_reset_model: fn(*const FileSystemTreeQObject), @@ -648,6 +686,8 @@ pub extern "C" fn file_system_tree_new( }; let model = FileSystemTreeTree { qobject: file_system_tree, + layout_about_to_be_changed: file_system_tree_layout_about_to_be_changed, + layout_changed: file_system_tree_layout_changed, data_changed: file_system_tree_data_changed, begin_reset_model: file_system_tree_begin_reset_model, end_reset_model: file_system_tree_end_reset_model, @@ -835,6 +875,8 @@ impl ProcessesEmitter { pub struct ProcessesTree { qobject: *const ProcessesQObject, + layout_about_to_be_changed: fn(*const ProcessesQObject), + layout_changed: fn(*const ProcessesQObject), data_changed: fn(*const ProcessesQObject, usize, usize), begin_reset_model: fn(*const ProcessesQObject), end_reset_model: fn(*const ProcessesQObject), @@ -847,6 +889,12 @@ pub struct ProcessesTree { } impl ProcessesTree { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -904,6 +952,8 @@ pub extern "C" fn processes_new( processes: *mut ProcessesQObject, processes_active_changed: fn(*const ProcessesQObject), processes_new_data_ready: fn(*const ProcessesQObject, index: COption), + processes_layout_about_to_be_changed: fn(*const ProcessesQObject), + processes_layout_changed: fn(*const ProcessesQObject), processes_data_changed: fn(*const ProcessesQObject, usize, usize), processes_begin_reset_model: fn(*const ProcessesQObject), processes_end_reset_model: fn(*const ProcessesQObject), @@ -921,6 +971,8 @@ pub extern "C" fn processes_new( }; let model = ProcessesTree { qobject: processes, + layout_about_to_be_changed: processes_layout_about_to_be_changed, + layout_changed: processes_layout_changed, data_changed: processes_data_changed, begin_reset_model: processes_begin_reset_model, end_reset_model: processes_end_reset_model, @@ -1081,6 +1133,8 @@ impl TimeSeriesEmitter { pub struct TimeSeriesList { qobject: *const TimeSeriesQObject, + layout_about_to_be_changed: fn(*const TimeSeriesQObject), + layout_changed: fn(*const TimeSeriesQObject), data_changed: fn(*const TimeSeriesQObject, usize, usize), begin_reset_model: fn(*const TimeSeriesQObject), end_reset_model: fn(*const TimeSeriesQObject), @@ -1093,6 +1147,12 @@ pub struct TimeSeriesList { } impl TimeSeriesList { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -1145,6 +1205,8 @@ pub trait TimeSeriesTrait { pub extern "C" fn time_series_new( time_series: *mut TimeSeriesQObject, time_series_new_data_ready: fn(*const TimeSeriesQObject), + time_series_layout_about_to_be_changed: fn(*const TimeSeriesQObject), + time_series_layout_changed: fn(*const TimeSeriesQObject), time_series_data_changed: fn(*const TimeSeriesQObject, usize, usize), time_series_begin_reset_model: fn(*const TimeSeriesQObject), time_series_end_reset_model: fn(*const TimeSeriesQObject), @@ -1161,6 +1223,8 @@ pub extern "C" fn time_series_new( }; let model = TimeSeriesList { qobject: time_series, + layout_about_to_be_changed: time_series_layout_about_to_be_changed, + layout_changed: time_series_layout_changed, data_changed: time_series_data_changed, begin_reset_model: time_series_begin_reset_model, end_reset_model: time_series_end_reset_model, diff --git a/demo/src/Bindings.cpp b/demo/src/Bindings.cpp index 0576ec1..7eb64cb 100644 --- a/demo/src/Bindings.cpp +++ b/demo/src/Bindings.cpp @@ -71,6 +71,8 @@ namespace { extern "C" { Demo::Private* demo_new(Demo*, Fibonacci*, void (*)(Fibonacci*), void (*)(Fibonacci*), FibonacciList*, void (*)(const FibonacciList*), + void (*)(FibonacciList*), + void (*)(FibonacciList*), void (*)(FibonacciList*, quintptr, quintptr), void (*)(FibonacciList*), void (*)(FibonacciList*), @@ -81,6 +83,8 @@ extern "C" { void (*)(FibonacciList*, int, int), void (*)(FibonacciList*), FileSystemTree*, void (*)(FileSystemTree*), void (*)(const FileSystemTree*, option_quintptr), + void (*)(FileSystemTree*), + void (*)(FileSystemTree*), void (*)(FileSystemTree*, quintptr, quintptr), void (*)(FileSystemTree*), void (*)(FileSystemTree*), @@ -91,6 +95,8 @@ extern "C" { void (*)(FileSystemTree*, option_quintptr, int, int), void (*)(FileSystemTree*), Processes*, void (*)(Processes*), void (*)(const Processes*, option_quintptr), + void (*)(Processes*), + void (*)(Processes*), void (*)(Processes*, quintptr, quintptr), void (*)(Processes*), void (*)(Processes*), @@ -101,6 +107,8 @@ extern "C" { void (*)(Processes*, option_quintptr, int, int), void (*)(Processes*), TimeSeries*, void (*)(const TimeSeries*), + void (*)(TimeSeries*), + void (*)(TimeSeries*), void (*)(TimeSeries*, quintptr, quintptr), void (*)(TimeSeries*), void (*)(TimeSeries*), @@ -266,6 +274,8 @@ bool FibonacciList::setHeaderData(int section, Qt::Orientation orientation, cons extern "C" { FibonacciList::Private* fibonacci_list_new(FibonacciList*, void (*)(const FibonacciList*), + void (*)(FibonacciList*), + void (*)(FibonacciList*), void (*)(FibonacciList*, quintptr, quintptr), void (*)(FibonacciList*), void (*)(FibonacciList*), @@ -513,6 +523,8 @@ bool FileSystemTree::setHeaderData(int section, Qt::Orientation orientation, con extern "C" { FileSystemTree::Private* file_system_tree_new(FileSystemTree*, void (*)(FileSystemTree*), void (*)(const FileSystemTree*, option_quintptr), + void (*)(FileSystemTree*), + void (*)(FileSystemTree*), void (*)(FileSystemTree*, quintptr, quintptr), void (*)(FileSystemTree*), void (*)(FileSystemTree*), @@ -756,6 +768,8 @@ bool Processes::setHeaderData(int section, Qt::Orientation orientation, const QV extern "C" { Processes::Private* processes_new(Processes*, void (*)(Processes*), void (*)(const Processes*, option_quintptr), + void (*)(Processes*), + void (*)(Processes*), void (*)(Processes*, quintptr, quintptr), void (*)(Processes*), void (*)(Processes*), @@ -1009,6 +1023,8 @@ bool TimeSeries::setData(const QModelIndex &index, const QVariant &value, int ro extern "C" { TimeSeries::Private* time_series_new(TimeSeries*, void (*)(const TimeSeries*), + void (*)(TimeSeries*), + void (*)(TimeSeries*), void (*)(TimeSeries*, quintptr, quintptr), void (*)(TimeSeries*), void (*)(TimeSeries*), @@ -1046,6 +1062,12 @@ Demo::Demo(QObject *parent): [](const FibonacciList* o) { emit o->newDataReady(QModelIndex()); }, + [](FibonacciList* o) { + emit o->layoutAboutToBeChanged(); + }, + [](FibonacciList* o) { + emit o->layoutChanged(); + }, [](FibonacciList* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 1, last)); @@ -1084,6 +1106,12 @@ Demo::Demo(QObject *parent): emit o->newDataReady(QModelIndex()); } }, + [](FileSystemTree* o) { + emit o->layoutAboutToBeChanged(); + }, + [](FileSystemTree* o) { + emit o->layoutChanged(); + }, [](FileSystemTree* o, quintptr first, quintptr last) { quintptr frow = file_system_tree_row(o->m_d, first); quintptr lrow = file_system_tree_row(o->m_d, first); @@ -1144,6 +1172,12 @@ Demo::Demo(QObject *parent): emit o->newDataReady(QModelIndex()); } }, + [](Processes* o) { + emit o->layoutAboutToBeChanged(); + }, + [](Processes* o) { + emit o->layoutChanged(); + }, [](Processes* o, quintptr first, quintptr last) { quintptr frow = processes_row(o->m_d, first); quintptr lrow = processes_row(o->m_d, first); @@ -1198,6 +1232,12 @@ Demo::Demo(QObject *parent): [](const TimeSeries* o) { emit o->newDataReady(QModelIndex()); }, + [](TimeSeries* o) { + emit o->layoutAboutToBeChanged(); + }, + [](TimeSeries* o) { + emit o->layoutChanged(); + }, [](TimeSeries* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 2, last)); @@ -1339,6 +1379,12 @@ FibonacciList::FibonacciList(QObject *parent): [](const FibonacciList* o) { emit o->newDataReady(QModelIndex()); }, + [](FibonacciList* o) { + emit o->layoutAboutToBeChanged(); + }, + [](FibonacciList* o) { + emit o->layoutChanged(); + }, [](FibonacciList* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 1, last)); @@ -1405,6 +1451,12 @@ FileSystemTree::FileSystemTree(QObject *parent): emit o->newDataReady(QModelIndex()); } }, + [](FileSystemTree* o) { + emit o->layoutAboutToBeChanged(); + }, + [](FileSystemTree* o) { + emit o->layoutChanged(); + }, [](FileSystemTree* o, quintptr first, quintptr last) { quintptr frow = file_system_tree_row(o->m_d, first); quintptr lrow = file_system_tree_row(o->m_d, first); @@ -1509,6 +1561,12 @@ Processes::Processes(QObject *parent): emit o->newDataReady(QModelIndex()); } }, + [](Processes* o) { + emit o->layoutAboutToBeChanged(); + }, + [](Processes* o) { + emit o->layoutChanged(); + }, [](Processes* o, quintptr first, quintptr last) { quintptr frow = processes_row(o->m_d, first); quintptr lrow = processes_row(o->m_d, first); @@ -1599,6 +1657,12 @@ TimeSeries::TimeSeries(QObject *parent): [](const TimeSeries* o) { emit o->newDataReady(QModelIndex()); }, + [](TimeSeries* o) { + emit o->layoutAboutToBeChanged(); + }, + [](TimeSeries* o) { + emit o->layoutChanged(); + }, [](TimeSeries* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 2, last)); diff --git a/src/cpp.cpp b/src/cpp.cpp index 400c10d..a113e22 100644 --- a/src/cpp.cpp +++ b/src/cpp.cpp @@ -638,6 +638,8 @@ void constructorArgsDecl(QTextStream& cpp, const Object& o, const Configuration& if (o.type == ObjectType::List) { cpp << QString(R"(, void (*)(const %1*), + void (*)(%1*), + void (*)(%1*), void (*)(%1*, quintptr, quintptr), void (*)(%1*), void (*)(%1*), @@ -651,6 +653,8 @@ void constructorArgsDecl(QTextStream& cpp, const Object& o, const Configuration& if (o.type == ObjectType::Tree) { cpp << QString(R"(, void (*)(const %1*, option_quintptr), + void (*)(%1*), + void (*)(%1*), void (*)(%1*, quintptr, quintptr), void (*)(%1*), void (*)(%1*), @@ -683,6 +687,12 @@ void constructorArgs(QTextStream& cpp, const QString& prefix, const Object& o, c [](const %1* o) { emit o->newDataReady(QModelIndex()); }, + [](%1* o) { + emit o->layoutAboutToBeChanged(); + }, + [](%1* o) { + emit o->layoutChanged(); + }, [](%1* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, %2, last)); @@ -723,6 +733,12 @@ void constructorArgs(QTextStream& cpp, const QString& prefix, const Object& o, c emit o->newDataReady(QModelIndex()); } }, + [](%1* o) { + emit o->layoutAboutToBeChanged(); + }, + [](%1* o) { + emit o->layoutChanged(); + }, [](%1* o, quintptr first, quintptr last) { quintptr frow = %2_row(o->m_d, first); quintptr lrow = %2_row(o->m_d, first); diff --git a/src/rust.cpp b/src/rust.cpp index d07ae16..62cc23f 100644 --- a/src/rust.cpp +++ b/src/rust.cpp @@ -95,6 +95,8 @@ void rConstructorArgsDecl(QTextStream& r, const QString& name, const Object& o, destDecl = " index: COption,"; } r << QString(R"(, + %3_layout_about_to_be_changed: fn(*const %1QObject), + %3_layout_changed: fn(*const %1QObject), %3_data_changed: fn(*const %1QObject, usize, usize), %3_begin_reset_model: fn(*const %1QObject), %3_end_reset_model: fn(*const %1QObject), @@ -133,6 +135,8 @@ void rConstructorArgs(QTextStream& r, const QString& name, const Object& o, cons r << QString(R"( }; let model = %1%2 { qobject: %3, + layout_about_to_be_changed: %4_layout_about_to_be_changed, + layout_changed: %4_layout_changed, data_changed: %4_data_changed, begin_reset_model: %4_begin_reset_model, end_reset_model: %4_end_reset_model, @@ -293,6 +297,8 @@ impl %1Emitter { pub struct %1%2 { qobject: *const %1QObject, + layout_about_to_be_changed: fn(*const %1QObject), + layout_changed: fn(*const %1QObject), data_changed: fn(*const %1QObject, usize, usize), begin_reset_model: fn(*const %1QObject), end_reset_model: fn(*const %1QObject), @@ -305,6 +311,12 @@ pub struct %1%2 { } impl %1%2 { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } diff --git a/tests/rust_list/src/interface.rs b/tests/rust_list/src/interface.rs index b96be91..77648bd 100644 --- a/tests/rust_list/src/interface.rs +++ b/tests/rust_list/src/interface.rs @@ -115,6 +115,8 @@ impl NoRoleEmitter { pub struct NoRoleList { qobject: *const NoRoleQObject, + layout_about_to_be_changed: fn(*const NoRoleQObject), + layout_changed: fn(*const NoRoleQObject), data_changed: fn(*const NoRoleQObject, usize, usize), begin_reset_model: fn(*const NoRoleQObject), end_reset_model: fn(*const NoRoleQObject), @@ -127,6 +129,12 @@ pub struct NoRoleList { } impl NoRoleList { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -177,6 +185,8 @@ pub trait NoRoleTrait { pub extern "C" fn no_role_new( no_role: *mut NoRoleQObject, no_role_new_data_ready: fn(*const NoRoleQObject), + no_role_layout_about_to_be_changed: fn(*const NoRoleQObject), + no_role_layout_changed: fn(*const NoRoleQObject), no_role_data_changed: fn(*const NoRoleQObject, usize, usize), no_role_begin_reset_model: fn(*const NoRoleQObject), no_role_end_reset_model: fn(*const NoRoleQObject), @@ -193,6 +203,8 @@ pub extern "C" fn no_role_new( }; let model = NoRoleList { qobject: no_role, + layout_about_to_be_changed: no_role_layout_about_to_be_changed, + layout_changed: no_role_layout_changed, data_changed: no_role_data_changed, begin_reset_model: no_role_begin_reset_model, end_reset_model: no_role_end_reset_model, @@ -302,6 +314,8 @@ impl PersonsEmitter { pub struct PersonsList { qobject: *const PersonsQObject, + layout_about_to_be_changed: fn(*const PersonsQObject), + layout_changed: fn(*const PersonsQObject), data_changed: fn(*const PersonsQObject, usize, usize), begin_reset_model: fn(*const PersonsQObject), end_reset_model: fn(*const PersonsQObject), @@ -314,6 +328,12 @@ pub struct PersonsList { } impl PersonsList { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -362,6 +382,8 @@ pub trait PersonsTrait { pub extern "C" fn persons_new( persons: *mut PersonsQObject, persons_new_data_ready: fn(*const PersonsQObject), + persons_layout_about_to_be_changed: fn(*const PersonsQObject), + persons_layout_changed: fn(*const PersonsQObject), persons_data_changed: fn(*const PersonsQObject, usize, usize), persons_begin_reset_model: fn(*const PersonsQObject), persons_end_reset_model: fn(*const PersonsQObject), @@ -378,6 +400,8 @@ pub extern "C" fn persons_new( }; let model = PersonsList { qobject: persons, + layout_about_to_be_changed: persons_layout_about_to_be_changed, + layout_changed: persons_layout_changed, data_changed: persons_data_changed, begin_reset_model: persons_begin_reset_model, end_reset_model: persons_end_reset_model, diff --git a/tests/rust_list_types/src/interface.rs b/tests/rust_list_types/src/interface.rs index 6ca9b67..ba751d1 100644 --- a/tests/rust_list_types/src/interface.rs +++ b/tests/rust_list_types/src/interface.rs @@ -118,6 +118,8 @@ impl ListEmitter { pub struct ListList { qobject: *const ListQObject, + layout_about_to_be_changed: fn(*const ListQObject), + layout_changed: fn(*const ListQObject), data_changed: fn(*const ListQObject, usize, usize), begin_reset_model: fn(*const ListQObject), end_reset_model: fn(*const ListQObject), @@ -130,6 +132,12 @@ pub struct ListList { } impl ListList { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -208,6 +216,8 @@ pub trait ListTrait { pub extern "C" fn list_new( list: *mut ListQObject, list_new_data_ready: fn(*const ListQObject), + list_layout_about_to_be_changed: fn(*const ListQObject), + list_layout_changed: fn(*const ListQObject), list_data_changed: fn(*const ListQObject, usize, usize), list_begin_reset_model: fn(*const ListQObject), list_end_reset_model: fn(*const ListQObject), @@ -224,6 +234,8 @@ pub extern "C" fn list_new( }; let model = ListList { qobject: list, + layout_about_to_be_changed: list_layout_about_to_be_changed, + layout_changed: list_layout_changed, data_changed: list_data_changed, begin_reset_model: list_begin_reset_model, end_reset_model: list_end_reset_model, diff --git a/tests/rust_tree/src/interface.rs b/tests/rust_tree/src/interface.rs index 38979d5..be7d5a7 100644 --- a/tests/rust_tree/src/interface.rs +++ b/tests/rust_tree/src/interface.rs @@ -115,6 +115,8 @@ impl PersonsEmitter { pub struct PersonsTree { qobject: *const PersonsQObject, + layout_about_to_be_changed: fn(*const PersonsQObject), + layout_changed: fn(*const PersonsQObject), data_changed: fn(*const PersonsQObject, usize, usize), begin_reset_model: fn(*const PersonsQObject), end_reset_model: fn(*const PersonsQObject), @@ -127,6 +129,12 @@ pub struct PersonsTree { } impl PersonsTree { + pub fn layout_about_to_be_changed(&self) { + (self.layout_about_to_be_changed)(self.qobject); + } + pub fn layout_changed(&self) { + (self.layout_changed)(self.qobject); + } pub fn data_changed(&self, first: usize, last: usize) { (self.data_changed)(self.qobject, first, last); } @@ -176,6 +184,8 @@ pub trait PersonsTrait { pub extern "C" fn persons_new( persons: *mut PersonsQObject, persons_new_data_ready: fn(*const PersonsQObject, index: COption), + persons_layout_about_to_be_changed: fn(*const PersonsQObject), + persons_layout_changed: fn(*const PersonsQObject), persons_data_changed: fn(*const PersonsQObject, usize, usize), persons_begin_reset_model: fn(*const PersonsQObject), persons_end_reset_model: fn(*const PersonsQObject), @@ -192,6 +202,8 @@ pub extern "C" fn persons_new( }; let model = PersonsTree { qobject: persons, + layout_about_to_be_changed: persons_layout_about_to_be_changed, + layout_changed: persons_layout_changed, data_changed: persons_data_changed, begin_reset_model: persons_begin_reset_model, end_reset_model: persons_end_reset_model, diff --git a/tests/test_list_rust.cpp b/tests/test_list_rust.cpp index 348051e..9d8e4b6 100644 --- a/tests/test_list_rust.cpp +++ b/tests/test_list_rust.cpp @@ -208,6 +208,8 @@ bool NoRole::setData(const QModelIndex &index, const QVariant &value, int role) extern "C" { NoRole::Private* no_role_new(NoRole*, void (*)(const NoRole*), + void (*)(NoRole*), + void (*)(NoRole*), void (*)(NoRole*, quintptr, quintptr), void (*)(NoRole*), void (*)(NoRole*), @@ -375,6 +377,8 @@ bool Persons::setData(const QModelIndex &index, const QVariant &value, int role) extern "C" { Persons::Private* persons_new(Persons*, void (*)(const Persons*), + void (*)(Persons*), + void (*)(Persons*), void (*)(Persons*, quintptr, quintptr), void (*)(Persons*), void (*)(Persons*), @@ -401,6 +405,12 @@ NoRole::NoRole(QObject *parent): [](const NoRole* o) { emit o->newDataReady(QModelIndex()); }, + [](NoRole* o) { + emit o->layoutAboutToBeChanged(); + }, + [](NoRole* o) { + emit o->layoutChanged(); + }, [](NoRole* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 0, last)); @@ -459,6 +469,12 @@ Persons::Persons(QObject *parent): [](const Persons* o) { emit o->newDataReady(QModelIndex()); }, + [](Persons* o) { + emit o->layoutAboutToBeChanged(); + }, + [](Persons* o) { + emit o->layoutChanged(); + }, [](Persons* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 0, last)); diff --git a/tests/test_list_types_rust.cpp b/tests/test_list_types_rust.cpp index dee9cb1..cd36f88 100644 --- a/tests/test_list_types_rust.cpp +++ b/tests/test_list_types_rust.cpp @@ -621,6 +621,8 @@ bool List::setData(const QModelIndex &index, const QVariant &value, int role) extern "C" { List::Private* list_new(List*, void (*)(const List*), + void (*)(List*), + void (*)(List*), void (*)(List*, quintptr, quintptr), void (*)(List*), void (*)(List*), @@ -647,6 +649,12 @@ List::List(QObject *parent): [](const List* o) { emit o->newDataReady(QModelIndex()); }, + [](List* o) { + emit o->layoutAboutToBeChanged(); + }, + [](List* o) { + emit o->layoutChanged(); + }, [](List* o, quintptr first, quintptr last) { o->dataChanged(o->createIndex(first, 0, first), o->createIndex(last, 0, last)); diff --git a/tests/test_tree_rust.cpp b/tests/test_tree_rust.cpp index 48da4b0..fc34a92 100644 --- a/tests/test_tree_rust.cpp +++ b/tests/test_tree_rust.cpp @@ -215,6 +215,8 @@ bool Persons::setData(const QModelIndex &index, const QVariant &value, int role) extern "C" { Persons::Private* persons_new(Persons*, void (*)(const Persons*, option_quintptr), + void (*)(Persons*), + void (*)(Persons*), void (*)(Persons*, quintptr, quintptr), void (*)(Persons*), void (*)(Persons*), @@ -246,6 +248,12 @@ Persons::Persons(QObject *parent): emit o->newDataReady(QModelIndex()); } }, + [](Persons* o) { + emit o->layoutAboutToBeChanged(); + }, + [](Persons* o) { + emit o->layoutChanged(); + }, [](Persons* o, quintptr first, quintptr last) { quintptr frow = persons_row(o->m_d, first); quintptr lrow = persons_row(o->m_d, first);