Add bindings for beginMoveRows and endMoveRows

master
Jos van den Oever 2018-09-08 21:54:34 +02:00
parent 2a3123eda3
commit b702c980af
10 changed files with 308 additions and 2 deletions

View File

@ -142,6 +142,8 @@ pub extern "C" fn demo_new(
fibonacci_list_end_reset_model: fn(*const FibonacciListQObject),
fibonacci_list_begin_insert_rows: fn(*const FibonacciListQObject, usize, usize),
fibonacci_list_end_insert_rows: fn(*const FibonacciListQObject),
fibonacci_list_begin_move_rows: fn(*const FibonacciListQObject, usize, usize, usize),
fibonacci_list_end_move_rows: fn(*const FibonacciListQObject),
fibonacci_list_begin_remove_rows: fn(*const FibonacciListQObject, usize, usize),
fibonacci_list_end_remove_rows: fn(*const FibonacciListQObject),
file_system_tree: *mut FileSystemTreeQObject,
@ -152,6 +154,8 @@ pub extern "C" fn demo_new(
file_system_tree_end_reset_model: fn(*const FileSystemTreeQObject),
file_system_tree_begin_insert_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize),
file_system_tree_end_insert_rows: fn(*const FileSystemTreeQObject),
file_system_tree_begin_move_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize, index: COption<usize>, usize),
file_system_tree_end_move_rows: fn(*const FileSystemTreeQObject),
file_system_tree_begin_remove_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize),
file_system_tree_end_remove_rows: fn(*const FileSystemTreeQObject),
processes: *mut ProcessesQObject,
@ -162,6 +166,8 @@ pub extern "C" fn demo_new(
processes_end_reset_model: fn(*const ProcessesQObject),
processes_begin_insert_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize),
processes_end_insert_rows: fn(*const ProcessesQObject),
processes_begin_move_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize, index: COption<usize>, usize),
processes_end_move_rows: fn(*const ProcessesQObject),
processes_begin_remove_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize),
processes_end_remove_rows: fn(*const ProcessesQObject),
time_series: *mut TimeSeriesQObject,
@ -171,6 +177,8 @@ pub extern "C" fn demo_new(
time_series_end_reset_model: fn(*const TimeSeriesQObject),
time_series_begin_insert_rows: fn(*const TimeSeriesQObject, usize, usize),
time_series_end_insert_rows: fn(*const TimeSeriesQObject),
time_series_begin_move_rows: fn(*const TimeSeriesQObject, usize, usize, usize),
time_series_end_move_rows: fn(*const TimeSeriesQObject),
time_series_begin_remove_rows: fn(*const TimeSeriesQObject, usize, usize),
time_series_end_remove_rows: fn(*const TimeSeriesQObject),
) -> *mut Demo {
@ -191,6 +199,8 @@ pub extern "C" fn demo_new(
end_reset_model: fibonacci_list_end_reset_model,
begin_insert_rows: fibonacci_list_begin_insert_rows,
end_insert_rows: fibonacci_list_end_insert_rows,
begin_move_rows: fibonacci_list_begin_move_rows,
end_move_rows: fibonacci_list_end_move_rows,
begin_remove_rows: fibonacci_list_begin_remove_rows,
end_remove_rows: fibonacci_list_end_remove_rows,
};
@ -207,6 +217,8 @@ pub extern "C" fn demo_new(
end_reset_model: file_system_tree_end_reset_model,
begin_insert_rows: file_system_tree_begin_insert_rows,
end_insert_rows: file_system_tree_end_insert_rows,
begin_move_rows: file_system_tree_begin_move_rows,
end_move_rows: file_system_tree_end_move_rows,
begin_remove_rows: file_system_tree_begin_remove_rows,
end_remove_rows: file_system_tree_end_remove_rows,
};
@ -223,6 +235,8 @@ pub extern "C" fn demo_new(
end_reset_model: processes_end_reset_model,
begin_insert_rows: processes_begin_insert_rows,
end_insert_rows: processes_end_insert_rows,
begin_move_rows: processes_begin_move_rows,
end_move_rows: processes_end_move_rows,
begin_remove_rows: processes_begin_remove_rows,
end_remove_rows: processes_end_remove_rows,
};
@ -238,6 +252,8 @@ pub extern "C" fn demo_new(
end_reset_model: time_series_end_reset_model,
begin_insert_rows: time_series_begin_insert_rows,
end_insert_rows: time_series_end_insert_rows,
begin_move_rows: time_series_begin_move_rows,
end_move_rows: time_series_end_move_rows,
begin_remove_rows: time_series_begin_remove_rows,
end_remove_rows: time_series_end_remove_rows,
};
@ -385,6 +401,8 @@ pub struct FibonacciListList {
end_reset_model: fn(*const FibonacciListQObject),
begin_insert_rows: fn(*const FibonacciListQObject, usize, usize),
end_insert_rows: fn(*const FibonacciListQObject),
begin_move_rows: fn(*const FibonacciListQObject, usize, usize, usize),
end_move_rows: fn(*const FibonacciListQObject),
begin_remove_rows: fn(*const FibonacciListQObject, usize, usize),
end_remove_rows: fn(*const FibonacciListQObject),
}
@ -405,6 +423,12 @@ impl FibonacciListList {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, first: usize, last: usize, destination: usize) {
(self.begin_move_rows)(self.qobject, first, last, destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, first, last);
}
@ -437,6 +461,8 @@ pub extern "C" fn fibonacci_list_new(
fibonacci_list_end_reset_model: fn(*const FibonacciListQObject),
fibonacci_list_begin_insert_rows: fn(*const FibonacciListQObject, usize, usize),
fibonacci_list_end_insert_rows: fn(*const FibonacciListQObject),
fibonacci_list_begin_move_rows: fn(*const FibonacciListQObject, usize, usize, usize),
fibonacci_list_end_move_rows: fn(*const FibonacciListQObject),
fibonacci_list_begin_remove_rows: fn(*const FibonacciListQObject, usize, usize),
fibonacci_list_end_remove_rows: fn(*const FibonacciListQObject),
) -> *mut FibonacciList {
@ -451,6 +477,8 @@ pub extern "C" fn fibonacci_list_new(
end_reset_model: fibonacci_list_end_reset_model,
begin_insert_rows: fibonacci_list_begin_insert_rows,
end_insert_rows: fibonacci_list_end_insert_rows,
begin_move_rows: fibonacci_list_begin_move_rows,
end_move_rows: fibonacci_list_end_move_rows,
begin_remove_rows: fibonacci_list_begin_remove_rows,
end_remove_rows: fibonacci_list_end_remove_rows,
};
@ -540,6 +568,8 @@ pub struct FileSystemTreeTree {
end_reset_model: fn(*const FileSystemTreeQObject),
begin_insert_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize),
end_insert_rows: fn(*const FileSystemTreeQObject),
begin_move_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize, dest: COption<usize>, usize),
end_move_rows: fn(*const FileSystemTreeQObject),
begin_remove_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize),
end_remove_rows: fn(*const FileSystemTreeQObject),
}
@ -560,6 +590,12 @@ impl FileSystemTreeTree {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, index: Option<usize>, first: usize, last: usize, dest: Option<usize>, destination: usize) {
(self.begin_move_rows)(self.qobject, index.into(), first, last, dest.into(), destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, index: Option<usize>, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, index.into(), first, last);
}
@ -600,6 +636,8 @@ pub extern "C" fn file_system_tree_new(
file_system_tree_end_reset_model: fn(*const FileSystemTreeQObject),
file_system_tree_begin_insert_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize),
file_system_tree_end_insert_rows: fn(*const FileSystemTreeQObject),
file_system_tree_begin_move_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize, index: COption<usize>, usize),
file_system_tree_end_move_rows: fn(*const FileSystemTreeQObject),
file_system_tree_begin_remove_rows: fn(*const FileSystemTreeQObject, index: COption<usize>, usize, usize),
file_system_tree_end_remove_rows: fn(*const FileSystemTreeQObject),
) -> *mut FileSystemTree {
@ -615,6 +653,8 @@ pub extern "C" fn file_system_tree_new(
end_reset_model: file_system_tree_end_reset_model,
begin_insert_rows: file_system_tree_begin_insert_rows,
end_insert_rows: file_system_tree_end_insert_rows,
begin_move_rows: file_system_tree_begin_move_rows,
end_move_rows: file_system_tree_end_move_rows,
begin_remove_rows: file_system_tree_begin_remove_rows,
end_remove_rows: file_system_tree_end_remove_rows,
};
@ -800,6 +840,8 @@ pub struct ProcessesTree {
end_reset_model: fn(*const ProcessesQObject),
begin_insert_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize),
end_insert_rows: fn(*const ProcessesQObject),
begin_move_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize, dest: COption<usize>, usize),
end_move_rows: fn(*const ProcessesQObject),
begin_remove_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize),
end_remove_rows: fn(*const ProcessesQObject),
}
@ -820,6 +862,12 @@ impl ProcessesTree {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, index: Option<usize>, first: usize, last: usize, dest: Option<usize>, destination: usize) {
(self.begin_move_rows)(self.qobject, index.into(), first, last, dest.into(), destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, index: Option<usize>, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, index.into(), first, last);
}
@ -861,6 +909,8 @@ pub extern "C" fn processes_new(
processes_end_reset_model: fn(*const ProcessesQObject),
processes_begin_insert_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize),
processes_end_insert_rows: fn(*const ProcessesQObject),
processes_begin_move_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize, index: COption<usize>, usize),
processes_end_move_rows: fn(*const ProcessesQObject),
processes_begin_remove_rows: fn(*const ProcessesQObject, index: COption<usize>, usize, usize),
processes_end_remove_rows: fn(*const ProcessesQObject),
) -> *mut Processes {
@ -876,6 +926,8 @@ pub extern "C" fn processes_new(
end_reset_model: processes_end_reset_model,
begin_insert_rows: processes_begin_insert_rows,
end_insert_rows: processes_end_insert_rows,
begin_move_rows: processes_begin_move_rows,
end_move_rows: processes_end_move_rows,
begin_remove_rows: processes_begin_remove_rows,
end_remove_rows: processes_end_remove_rows,
};
@ -1034,6 +1086,8 @@ pub struct TimeSeriesList {
end_reset_model: fn(*const TimeSeriesQObject),
begin_insert_rows: fn(*const TimeSeriesQObject, usize, usize),
end_insert_rows: fn(*const TimeSeriesQObject),
begin_move_rows: fn(*const TimeSeriesQObject, usize, usize, usize),
end_move_rows: fn(*const TimeSeriesQObject),
begin_remove_rows: fn(*const TimeSeriesQObject, usize, usize),
end_remove_rows: fn(*const TimeSeriesQObject),
}
@ -1054,6 +1108,12 @@ impl TimeSeriesList {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, first: usize, last: usize, destination: usize) {
(self.begin_move_rows)(self.qobject, first, last, destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, first, last);
}
@ -1090,6 +1150,8 @@ pub extern "C" fn time_series_new(
time_series_end_reset_model: fn(*const TimeSeriesQObject),
time_series_begin_insert_rows: fn(*const TimeSeriesQObject, usize, usize),
time_series_end_insert_rows: fn(*const TimeSeriesQObject),
time_series_begin_move_rows: fn(*const TimeSeriesQObject, usize, usize, usize),
time_series_end_move_rows: fn(*const TimeSeriesQObject),
time_series_begin_remove_rows: fn(*const TimeSeriesQObject, usize, usize),
time_series_end_remove_rows: fn(*const TimeSeriesQObject),
) -> *mut TimeSeries {
@ -1104,6 +1166,8 @@ pub extern "C" fn time_series_new(
end_reset_model: time_series_end_reset_model,
begin_insert_rows: time_series_begin_insert_rows,
end_insert_rows: time_series_end_insert_rows,
begin_move_rows: time_series_begin_move_rows,
end_move_rows: time_series_end_move_rows,
begin_remove_rows: time_series_begin_remove_rows,
end_remove_rows: time_series_end_remove_rows,
};

View File

@ -76,6 +76,8 @@ extern "C" {
void (*)(FibonacciList*),
void (*)(FibonacciList*, int, int),
void (*)(FibonacciList*),
void (*)(FibonacciList*, int, int, int),
void (*)(FibonacciList*),
void (*)(FibonacciList*, int, int),
void (*)(FibonacciList*), FileSystemTree*, void (*)(FileSystemTree*),
void (*)(const FileSystemTree*, option_quintptr),
@ -84,6 +86,8 @@ extern "C" {
void (*)(FileSystemTree*),
void (*)(FileSystemTree*, option_quintptr, int, int),
void (*)(FileSystemTree*),
void (*)(FileSystemTree*, option_quintptr, int, int, option_quintptr, int),
void (*)(FileSystemTree*),
void (*)(FileSystemTree*, option_quintptr, int, int),
void (*)(FileSystemTree*), Processes*, void (*)(Processes*),
void (*)(const Processes*, option_quintptr),
@ -92,6 +96,8 @@ extern "C" {
void (*)(Processes*),
void (*)(Processes*, option_quintptr, int, int),
void (*)(Processes*),
void (*)(Processes*, option_quintptr, int, int, option_quintptr, int),
void (*)(Processes*),
void (*)(Processes*, option_quintptr, int, int),
void (*)(Processes*), TimeSeries*,
void (*)(const TimeSeries*),
@ -100,6 +106,8 @@ extern "C" {
void (*)(TimeSeries*),
void (*)(TimeSeries*, int, int),
void (*)(TimeSeries*),
void (*)(TimeSeries*, int, int, int),
void (*)(TimeSeries*),
void (*)(TimeSeries*, int, int),
void (*)(TimeSeries*));
void demo_free(Demo::Private*);
@ -263,6 +271,8 @@ extern "C" {
void (*)(FibonacciList*),
void (*)(FibonacciList*, int, int),
void (*)(FibonacciList*),
void (*)(FibonacciList*, int, int, int),
void (*)(FibonacciList*),
void (*)(FibonacciList*, int, int),
void (*)(FibonacciList*));
void fibonacci_list_free(FibonacciList::Private*);
@ -508,6 +518,8 @@ extern "C" {
void (*)(FileSystemTree*),
void (*)(FileSystemTree*, option_quintptr, int, int),
void (*)(FileSystemTree*),
void (*)(FileSystemTree*, option_quintptr, int, int, option_quintptr, int),
void (*)(FileSystemTree*),
void (*)(FileSystemTree*, option_quintptr, int, int),
void (*)(FileSystemTree*));
void file_system_tree_free(FileSystemTree::Private*);
@ -749,6 +761,8 @@ extern "C" {
void (*)(Processes*),
void (*)(Processes*, option_quintptr, int, int),
void (*)(Processes*),
void (*)(Processes*, option_quintptr, int, int, option_quintptr, int),
void (*)(Processes*),
void (*)(Processes*, option_quintptr, int, int),
void (*)(Processes*));
void processes_free(Processes::Private*);
@ -1000,6 +1014,8 @@ extern "C" {
void (*)(TimeSeries*),
void (*)(TimeSeries*, int, int),
void (*)(TimeSeries*),
void (*)(TimeSeries*, int, int, int),
void (*)(TimeSeries*),
void (*)(TimeSeries*, int, int),
void (*)(TimeSeries*));
void time_series_free(TimeSeries::Private*);
@ -1046,6 +1062,12 @@ Demo::Demo(QObject *parent):
[](FibonacciList* o) {
o->endInsertRows();
},
[](FibonacciList* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](FibonacciList* o) {
o->endMoveRows();
},
[](FibonacciList* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},
@ -1085,6 +1107,22 @@ Demo::Demo(QObject *parent):
[](FileSystemTree* o) {
o->endInsertRows();
},
[](FileSystemTree* o, option_quintptr sourceParent, int first, int last, option_quintptr destinationParent, int destination) {
QModelIndex s;
if (sourceParent.some) {
int row = file_system_tree_row(o->m_d, sourceParent.value);
s = o->createIndex(row, 0, sourceParent.value);
}
QModelIndex d;
if (destinationParent.some) {
int row = file_system_tree_row(o->m_d, destinationParent.value);
d = o->createIndex(row, 0, destinationParent.value);
}
o->beginMoveRows(s, first, last, d, destination);
},
[](FileSystemTree* o) {
o->endMoveRows();
},
[](FileSystemTree* o, option_quintptr id, int first, int last) {
if (id.some) {
int row = file_system_tree_row(o->m_d, id.value);
@ -1129,6 +1167,22 @@ Demo::Demo(QObject *parent):
[](Processes* o) {
o->endInsertRows();
},
[](Processes* o, option_quintptr sourceParent, int first, int last, option_quintptr destinationParent, int destination) {
QModelIndex s;
if (sourceParent.some) {
int row = processes_row(o->m_d, sourceParent.value);
s = o->createIndex(row, 0, sourceParent.value);
}
QModelIndex d;
if (destinationParent.some) {
int row = processes_row(o->m_d, destinationParent.value);
d = o->createIndex(row, 0, destinationParent.value);
}
o->beginMoveRows(s, first, last, d, destination);
},
[](Processes* o) {
o->endMoveRows();
},
[](Processes* o, option_quintptr id, int first, int last) {
if (id.some) {
int row = processes_row(o->m_d, id.value);
@ -1160,6 +1214,12 @@ Demo::Demo(QObject *parent):
[](TimeSeries* o) {
o->endInsertRows();
},
[](TimeSeries* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](TimeSeries* o) {
o->endMoveRows();
},
[](TimeSeries* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},
@ -1295,6 +1355,12 @@ FibonacciList::FibonacciList(QObject *parent):
[](FibonacciList* o) {
o->endInsertRows();
},
[](FibonacciList* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](FibonacciList* o) {
o->endMoveRows();
},
[](FibonacciList* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},
@ -1362,6 +1428,22 @@ FileSystemTree::FileSystemTree(QObject *parent):
[](FileSystemTree* o) {
o->endInsertRows();
},
[](FileSystemTree* o, option_quintptr sourceParent, int first, int last, option_quintptr destinationParent, int destination) {
QModelIndex s;
if (sourceParent.some) {
int row = file_system_tree_row(o->m_d, sourceParent.value);
s = o->createIndex(row, 0, sourceParent.value);
}
QModelIndex d;
if (destinationParent.some) {
int row = file_system_tree_row(o->m_d, destinationParent.value);
d = o->createIndex(row, 0, destinationParent.value);
}
o->beginMoveRows(s, first, last, d, destination);
},
[](FileSystemTree* o) {
o->endMoveRows();
},
[](FileSystemTree* o, option_quintptr id, int first, int last) {
if (id.some) {
int row = file_system_tree_row(o->m_d, id.value);
@ -1450,6 +1532,22 @@ Processes::Processes(QObject *parent):
[](Processes* o) {
o->endInsertRows();
},
[](Processes* o, option_quintptr sourceParent, int first, int last, option_quintptr destinationParent, int destination) {
QModelIndex s;
if (sourceParent.some) {
int row = processes_row(o->m_d, sourceParent.value);
s = o->createIndex(row, 0, sourceParent.value);
}
QModelIndex d;
if (destinationParent.some) {
int row = processes_row(o->m_d, destinationParent.value);
d = o->createIndex(row, 0, destinationParent.value);
}
o->beginMoveRows(s, first, last, d, destination);
},
[](Processes* o) {
o->endMoveRows();
},
[](Processes* o, option_quintptr id, int first, int last) {
if (id.some) {
int row = processes_row(o->m_d, id.value);
@ -1517,6 +1615,12 @@ TimeSeries::TimeSeries(QObject *parent):
[](TimeSeries* o) {
o->endInsertRows();
},
[](TimeSeries* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](TimeSeries* o) {
o->endMoveRows();
},
[](TimeSeries* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},

View File

@ -643,6 +643,8 @@ void constructorArgsDecl(QTextStream& cpp, const Object& o, const Configuration&
void (*)(%1*),
void (*)(%1*, int, int),
void (*)(%1*),
void (*)(%1*, int, int, int),
void (*)(%1*),
void (*)(%1*, int, int),
void (*)(%1*))").arg(o.name);
}
@ -654,6 +656,8 @@ void constructorArgsDecl(QTextStream& cpp, const Object& o, const Configuration&
void (*)(%1*),
void (*)(%1*, option_quintptr, int, int),
void (*)(%1*),
void (*)(%1*, option_quintptr, int, int, option_quintptr, int),
void (*)(%1*),
void (*)(%1*, option_quintptr, int, int),
void (*)(%1*))").arg(o.name);
}
@ -695,6 +699,12 @@ void constructorArgs(QTextStream& cpp, const QString& prefix, const Object& o, c
[](%1* o) {
o->endInsertRows();
},
[](%1* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](%1* o) {
o->endMoveRows();
},
[](%1* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},
@ -736,6 +746,22 @@ void constructorArgs(QTextStream& cpp, const QString& prefix, const Object& o, c
[](%1* o) {
o->endInsertRows();
},
[](%1* o, option_quintptr sourceParent, int first, int last, option_quintptr destinationParent, int destination) {
QModelIndex s;
if (sourceParent.some) {
int row = %2_row(o->m_d, sourceParent.value);
s = o->createIndex(row, 0, sourceParent.value);
}
QModelIndex d;
if (destinationParent.some) {
int row = %2_row(o->m_d, destinationParent.value);
d = o->createIndex(row, 0, destinationParent.value);
}
o->beginMoveRows(s, first, last, d, destination);
},
[](%1* o) {
o->endMoveRows();
},
[](%1* o, option_quintptr id, int first, int last) {
if (id.some) {
int row = %2_row(o->m_d, id.value);

View File

@ -90,15 +90,21 @@ void rConstructorArgsDecl(QTextStream& r, const QString& name, const Object& o,
if (o.type == ObjectType::Tree) {
indexDecl = " index: COption<usize>,";
}
QString destDecl;
if (o.type == ObjectType::Tree) {
destDecl = " index: COption<usize>,";
}
r << QString(R"(,
%3_data_changed: fn(*const %1QObject, usize, usize),
%3_begin_reset_model: fn(*const %1QObject),
%3_end_reset_model: fn(*const %1QObject),
%3_begin_insert_rows: fn(*const %1QObject,%2 usize, usize),
%3_end_insert_rows: fn(*const %1QObject),
%3_begin_move_rows: fn(*const %1QObject,%2 usize, usize,%4 usize),
%3_end_move_rows: fn(*const %1QObject),
%3_begin_remove_rows: fn(*const %1QObject,%2 usize, usize),
%3_end_remove_rows: fn(*const %1QObject))").arg(o.name, indexDecl,
snakeCase(name));
snakeCase(name), destDecl);
}
}
@ -132,6 +138,8 @@ void rConstructorArgs(QTextStream& r, const QString& name, const Object& o, cons
end_reset_model: %4_end_reset_model,
begin_insert_rows: %4_begin_insert_rows,
end_insert_rows: %4_end_insert_rows,
begin_move_rows: %4_begin_move_rows,
end_move_rows: %4_end_move_rows,
begin_remove_rows: %4_begin_remove_rows,
end_remove_rows: %4_end_remove_rows,
)").arg(o.name, type, snakeCase(name), snakeCase(name));
@ -270,10 +278,16 @@ impl %1Emitter {
QString index;
QString indexDecl;
QString indexCDecl;
QString dest;
QString destDecl;
QString destCDecl;
if (o.type == ObjectType::Tree) {
indexDecl = " index: Option<usize>,";
indexCDecl = " index: COption<usize>,";
index = " index.into(),";
destDecl = " dest: Option<usize>,";
destCDecl = " dest: COption<usize>,";
dest = " dest.into(),";
}
r << QString(R"(}
@ -284,6 +298,8 @@ pub struct %1%2 {
end_reset_model: fn(*const %1QObject),
begin_insert_rows: fn(*const %1QObject,%5 usize, usize),
end_insert_rows: fn(*const %1QObject),
begin_move_rows: fn(*const %1QObject,%5 usize, usize,%8 usize),
end_move_rows: fn(*const %1QObject),
begin_remove_rows: fn(*const %1QObject,%5 usize, usize),
end_remove_rows: fn(*const %1QObject),
}
@ -304,13 +320,19 @@ impl %1%2 {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self,%3 first: usize, last: usize,%6 destination: usize) {
(self.begin_move_rows)(self.qobject,%4 first, last,%7 destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self,%3 first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject,%4 first, last);
}
pub fn end_remove_rows(&self) {
(self.end_remove_rows)(self.qobject);
}
)").arg(o.name, type, indexDecl, index, indexCDecl);
)").arg(o.name, type, indexDecl, index, indexCDecl, destDecl, dest, destCDecl);
}
r << QString(R"(}

View File

@ -120,6 +120,8 @@ pub struct NoRoleList {
end_reset_model: fn(*const NoRoleQObject),
begin_insert_rows: fn(*const NoRoleQObject, usize, usize),
end_insert_rows: fn(*const NoRoleQObject),
begin_move_rows: fn(*const NoRoleQObject, usize, usize, usize),
end_move_rows: fn(*const NoRoleQObject),
begin_remove_rows: fn(*const NoRoleQObject, usize, usize),
end_remove_rows: fn(*const NoRoleQObject),
}
@ -140,6 +142,12 @@ impl NoRoleList {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, first: usize, last: usize, destination: usize) {
(self.begin_move_rows)(self.qobject, first, last, destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, first, last);
}
@ -174,6 +182,8 @@ pub extern "C" fn no_role_new(
no_role_end_reset_model: fn(*const NoRoleQObject),
no_role_begin_insert_rows: fn(*const NoRoleQObject, usize, usize),
no_role_end_insert_rows: fn(*const NoRoleQObject),
no_role_begin_move_rows: fn(*const NoRoleQObject, usize, usize, usize),
no_role_end_move_rows: fn(*const NoRoleQObject),
no_role_begin_remove_rows: fn(*const NoRoleQObject, usize, usize),
no_role_end_remove_rows: fn(*const NoRoleQObject),
) -> *mut NoRole {
@ -188,6 +198,8 @@ pub extern "C" fn no_role_new(
end_reset_model: no_role_end_reset_model,
begin_insert_rows: no_role_begin_insert_rows,
end_insert_rows: no_role_end_insert_rows,
begin_move_rows: no_role_begin_move_rows,
end_move_rows: no_role_end_move_rows,
begin_remove_rows: no_role_begin_remove_rows,
end_remove_rows: no_role_end_remove_rows,
};
@ -295,6 +307,8 @@ pub struct PersonsList {
end_reset_model: fn(*const PersonsQObject),
begin_insert_rows: fn(*const PersonsQObject, usize, usize),
end_insert_rows: fn(*const PersonsQObject),
begin_move_rows: fn(*const PersonsQObject, usize, usize, usize),
end_move_rows: fn(*const PersonsQObject),
begin_remove_rows: fn(*const PersonsQObject, usize, usize),
end_remove_rows: fn(*const PersonsQObject),
}
@ -315,6 +329,12 @@ impl PersonsList {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, first: usize, last: usize, destination: usize) {
(self.begin_move_rows)(self.qobject, first, last, destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, first, last);
}
@ -347,6 +367,8 @@ pub extern "C" fn persons_new(
persons_end_reset_model: fn(*const PersonsQObject),
persons_begin_insert_rows: fn(*const PersonsQObject, usize, usize),
persons_end_insert_rows: fn(*const PersonsQObject),
persons_begin_move_rows: fn(*const PersonsQObject, usize, usize, usize),
persons_end_move_rows: fn(*const PersonsQObject),
persons_begin_remove_rows: fn(*const PersonsQObject, usize, usize),
persons_end_remove_rows: fn(*const PersonsQObject),
) -> *mut Persons {
@ -361,6 +383,8 @@ pub extern "C" fn persons_new(
end_reset_model: persons_end_reset_model,
begin_insert_rows: persons_begin_insert_rows,
end_insert_rows: persons_end_insert_rows,
begin_move_rows: persons_begin_move_rows,
end_move_rows: persons_end_move_rows,
begin_remove_rows: persons_begin_remove_rows,
end_remove_rows: persons_end_remove_rows,
};

View File

@ -123,6 +123,8 @@ pub struct ListList {
end_reset_model: fn(*const ListQObject),
begin_insert_rows: fn(*const ListQObject, usize, usize),
end_insert_rows: fn(*const ListQObject),
begin_move_rows: fn(*const ListQObject, usize, usize, usize),
end_move_rows: fn(*const ListQObject),
begin_remove_rows: fn(*const ListQObject, usize, usize),
end_remove_rows: fn(*const ListQObject),
}
@ -143,6 +145,12 @@ impl ListList {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, first: usize, last: usize, destination: usize) {
(self.begin_move_rows)(self.qobject, first, last, destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, first, last);
}
@ -205,6 +213,8 @@ pub extern "C" fn list_new(
list_end_reset_model: fn(*const ListQObject),
list_begin_insert_rows: fn(*const ListQObject, usize, usize),
list_end_insert_rows: fn(*const ListQObject),
list_begin_move_rows: fn(*const ListQObject, usize, usize, usize),
list_end_move_rows: fn(*const ListQObject),
list_begin_remove_rows: fn(*const ListQObject, usize, usize),
list_end_remove_rows: fn(*const ListQObject),
) -> *mut List {
@ -219,6 +229,8 @@ pub extern "C" fn list_new(
end_reset_model: list_end_reset_model,
begin_insert_rows: list_begin_insert_rows,
end_insert_rows: list_end_insert_rows,
begin_move_rows: list_begin_move_rows,
end_move_rows: list_end_move_rows,
begin_remove_rows: list_begin_remove_rows,
end_remove_rows: list_end_remove_rows,
};

View File

@ -120,6 +120,8 @@ pub struct PersonsTree {
end_reset_model: fn(*const PersonsQObject),
begin_insert_rows: fn(*const PersonsQObject, index: COption<usize>, usize, usize),
end_insert_rows: fn(*const PersonsQObject),
begin_move_rows: fn(*const PersonsQObject, index: COption<usize>, usize, usize, dest: COption<usize>, usize),
end_move_rows: fn(*const PersonsQObject),
begin_remove_rows: fn(*const PersonsQObject, index: COption<usize>, usize, usize),
end_remove_rows: fn(*const PersonsQObject),
}
@ -140,6 +142,12 @@ impl PersonsTree {
pub fn end_insert_rows(&self) {
(self.end_insert_rows)(self.qobject);
}
pub fn begin_move_rows(&self, index: Option<usize>, first: usize, last: usize, dest: Option<usize>, destination: usize) {
(self.begin_move_rows)(self.qobject, index.into(), first, last, dest.into(), destination);
}
pub fn end_move_rows(&self) {
(self.end_move_rows)(self.qobject);
}
pub fn begin_remove_rows(&self, index: Option<usize>, first: usize, last: usize) {
(self.begin_remove_rows)(self.qobject, index.into(), first, last);
}
@ -173,6 +181,8 @@ pub extern "C" fn persons_new(
persons_end_reset_model: fn(*const PersonsQObject),
persons_begin_insert_rows: fn(*const PersonsQObject, index: COption<usize>, usize, usize),
persons_end_insert_rows: fn(*const PersonsQObject),
persons_begin_move_rows: fn(*const PersonsQObject, index: COption<usize>, usize, usize, index: COption<usize>, usize),
persons_end_move_rows: fn(*const PersonsQObject),
persons_begin_remove_rows: fn(*const PersonsQObject, index: COption<usize>, usize, usize),
persons_end_remove_rows: fn(*const PersonsQObject),
) -> *mut Persons {
@ -187,6 +197,8 @@ pub extern "C" fn persons_new(
end_reset_model: persons_end_reset_model,
begin_insert_rows: persons_begin_insert_rows,
end_insert_rows: persons_end_insert_rows,
begin_move_rows: persons_begin_move_rows,
end_move_rows: persons_end_move_rows,
begin_remove_rows: persons_begin_remove_rows,
end_remove_rows: persons_end_remove_rows,
};

View File

@ -213,6 +213,8 @@ extern "C" {
void (*)(NoRole*),
void (*)(NoRole*, int, int),
void (*)(NoRole*),
void (*)(NoRole*, int, int, int),
void (*)(NoRole*),
void (*)(NoRole*, int, int),
void (*)(NoRole*));
void no_role_free(NoRole::Private*);
@ -378,6 +380,8 @@ extern "C" {
void (*)(Persons*),
void (*)(Persons*, int, int),
void (*)(Persons*),
void (*)(Persons*, int, int, int),
void (*)(Persons*),
void (*)(Persons*, int, int),
void (*)(Persons*));
void persons_free(Persons::Private*);
@ -413,6 +417,12 @@ NoRole::NoRole(QObject *parent):
[](NoRole* o) {
o->endInsertRows();
},
[](NoRole* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](NoRole* o) {
o->endMoveRows();
},
[](NoRole* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},
@ -465,6 +475,12 @@ Persons::Persons(QObject *parent):
[](Persons* o) {
o->endInsertRows();
},
[](Persons* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](Persons* o) {
o->endMoveRows();
},
[](Persons* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},

View File

@ -626,6 +626,8 @@ extern "C" {
void (*)(List*),
void (*)(List*, int, int),
void (*)(List*),
void (*)(List*, int, int, int),
void (*)(List*),
void (*)(List*, int, int),
void (*)(List*));
void list_free(List::Private*);
@ -661,6 +663,12 @@ List::List(QObject *parent):
[](List* o) {
o->endInsertRows();
},
[](List* o, int first, int last, int destination) {
o->beginMoveRows(QModelIndex(), first, last, QModelIndex(), destination);
},
[](List* o) {
o->endMoveRows();
},
[](List* o, int first, int last) {
o->beginRemoveRows(QModelIndex(), first, last);
},

View File

@ -220,6 +220,8 @@ extern "C" {
void (*)(Persons*),
void (*)(Persons*, option_quintptr, int, int),
void (*)(Persons*),
void (*)(Persons*, option_quintptr, int, int, option_quintptr, int),
void (*)(Persons*),
void (*)(Persons*, option_quintptr, int, int),
void (*)(Persons*));
void persons_free(Persons::Private*);
@ -267,6 +269,22 @@ Persons::Persons(QObject *parent):
[](Persons* o) {
o->endInsertRows();
},
[](Persons* o, option_quintptr sourceParent, int first, int last, option_quintptr destinationParent, int destination) {
QModelIndex s;
if (sourceParent.some) {
int row = persons_row(o->m_d, sourceParent.value);
s = o->createIndex(row, 0, sourceParent.value);
}
QModelIndex d;
if (destinationParent.some) {
int row = persons_row(o->m_d, destinationParent.value);
d = o->createIndex(row, 0, destinationParent.value);
}
o->beginMoveRows(s, first, last, d, destination);
},
[](Persons* o) {
o->endMoveRows();
},
[](Persons* o, option_quintptr id, int first, int last) {
if (id.some) {
int row = persons_row(o->m_d, id.value);