I followed the Qt guidelines for implementing a custom QAbstractTableModel; that is, I implemented the virtual function insertRows. The declaration of this function does not take any custom data structures. Thus the function simply uses the default constructor to create my data structure.
What if I have an existing custom object that I want to insert? Since I see no way of inserting an already existing object in insertRows (due to its function signature), I feel forced to implement a default constructor, call insertRows to insert an empty object, and then call setData to replace the empty object with the already existing object.
Am I doing this wrong? Is there a better way?