[SOLVED] QAbstractListModel with custom data type
I have created a QAbstractListModel that stores and displays a custom data type, Language objects whose constructors accept 2 QStrings and 1 QIcon. As a read-only model it works fine. However, I can't figure how to add new items to an empty model. In particular, I want to put items into an empty model from a populated one. This should be achieved with drag and drop and probably a button. Note that I don't want the items themselves to be editable.
After searching for hours, I was able to find examples, both in the Docs and on the net, but all involved Qt's standard types (QStrings, etc), so I have trouble understanding how I should handle my custom data type and which functions I should reimplement.
Any ideas or, better yet, any examples will be appreciated.
After searching in the wrong direction and messed up with mimeData, dropMimeData, etc, the solution was to implement correctly setData() and insertRows() and set the correct flags for drag and drop.