Quote Originally Posted by jfinn88 View Post
if I do would like to allocate memory on the heap, to do I use the keyword "new"?).
Yes.
But QList will allocate its memory on the heap anyway.

Quote Originally Posted by jfinn88 View Post
It seems to hang on setting the context property in main.cpp when I run the debugger with break points.
strange, that part looks ok.
You are just not loading any QML.

Quote Originally Posted by jfinn88 View Post
My understanding is I create a model in C++ which must include the rowCount(), roleNames(), data() functions.
Yes, correct.
rowCount() and data() are pure virtual and need to be implemented in order to the class to be instantiable.
roleNames() is necessary for the QML integration.

Quote Originally Posted by jfinn88 View Post
Will also need an enum var to declare the roleNames to be used.
You already have the enum for the roles.
The only thing there is that you need to base the first enum relative to Qt::UserRole, otherwise the first role's integer value will be 0.

Quote Originally Posted by jfinn88 View Post
I believe the roleNames have to be the same name as the column header in the sqlite database.
No, these do not have to relate.
The role names are purely for the QML engine.

Quote Originally Posted by jfinn88 View Post
I use a sql statement to select data from the database then I loop through the query and add it to the data struct.
You don't need to allocate the instance with new, in fact you are currently leaking each object.

Quote Originally Posted by jfinn88 View Post
Use the data struct to populate the list.
There is currently a mismatch between what you tell beginInsertRows() and usng append().
Your beginInsertRows() values say that you are adding the new entry at the beginning, while append() then actually adds it to the end of the list.

Quote Originally Posted by jfinn88 View Post
each row I pull from the database is an element of the list. Is this understanding correct?
Yes.

Your data() method is currently incorrect though.
The role selects which of the fields of one entry you need to return, that part is correct.

But which message to get from the list needs to be derived from the index, i.e. the message that is shown in the respective row.

Alternatively to creatng your own list model you could consider deriving from QSqlQueryModel, adding roleNames() and modifying data() such that is used the role information so that it ask the base class for the right column.

Cheers,
_