The easiest way is to pass the row index, since the view and the model have the same concept of what a row is
In your delegate
mod.deletepages(model.index)
mod.deletepages(model.index)
To copy to clipboard, switch view to plain text mode
In your model
void listmodel::deletepages(int row)
{
m_list.remove(row);
endRemoveRows();
}
void listmodel::deletepages(int row)
{
beginRemoveRows(QModelIndex(), row, row);
m_list.remove(row);
endRemoveRows();
}
To copy to clipboard, switch view to plain text mode
Ideally you don't do two calls from QML though, but have one C++ method that modifies the model and the database.
Otherwise you could forget one and model and database could get out of sync.
Cheers,
_
Bookmarks