Question

I am trying to get my head wrapped around the QAbstractTableModel and am not quite sure how to get started. I have the following: Reading from a socket, It returns a bunch of lines of strings - terminated with EOL..

I dump all of this into a QStringList. I then need to parse this line by line to create my rows and columns of my table. I have written a function to parse the list, but not sure if I should pass a pointer to the ModelIndex, and build the table , and if so what does that look like... Cant really sseem to find an example that is building a dynamic table with multiple rows and columns that are of unknown size at creation. A bit confused about how to do this.

Thanks, Todd

Was it helpful?

Solution

I think what you're looking for is QAbstractItemModel's canFetchMore and fetchMore methods. These are meant for dynamic models (of unknown/large size), and help to inform your attached views that more data is available to display. An example of using this method can be found in the fetchmore example in the Qt examples.

Much more complex examples (using threads, for instance) can be found throughout the Qt codebase:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top