attempting to add wrapper move function

I believe this won't work, but it's an attempt
This commit is contained in:
Chris Cochrun 2023-09-18 15:44:41 -05:00
parent 42f65b5516
commit b0435e197c
2 changed files with 16 additions and 0 deletions

View file

@ -394,6 +394,21 @@ bool ServiceItemModel::moveUp(int id) {
return false; return false;
} }
bool ServiceItemModel::moveRowsRust(int source, int dest, int count, ServiceItemMod *rustModel) {
const QModelIndex parent = index(source).parent();
const bool isMoveDown = dest > source;
if (!beginMoveRows(parent, source, source + count - 1,
parent, dest)) {
qDebug() << "Can't move rows";
return false;
}
const bool moved = rustModel->moveRows(source, dest, count);
endMoveRows();
return moved;
}
QVariantMap ServiceItemModel::getRust(int index, ServiceItemMod *rustModel) const { QVariantMap ServiceItemModel::getRust(int index, ServiceItemMod *rustModel) const {
QVariantMap item = rustModel->getItem(index); QVariantMap item = rustModel->getItem(index);
return item; return item;

View file

@ -66,6 +66,7 @@ public:
Q_INVOKABLE void removeItem(int index); Q_INVOKABLE void removeItem(int index);
Q_INVOKABLE void removeItems(); Q_INVOKABLE void removeItems();
Q_INVOKABLE bool moveRows(int sourceIndex, int destIndex, int count); Q_INVOKABLE bool moveRows(int sourceIndex, int destIndex, int count);
Q_INVOKABLE bool moveRowsRust(int source, int dest, int count, ServiceItemMod *rustModel);
Q_INVOKABLE bool moveDown(int index); Q_INVOKABLE bool moveDown(int index);
Q_INVOKABLE bool moveUp(int index); Q_INVOKABLE bool moveUp(int index);
Q_INVOKABLE bool select(int id); Q_INVOKABLE bool select(int id);