[Qt-interest] Using QAbstractTableModel with Custom Class

Bill Moo cppsysdev at gmail.com
Wed Jun 30 12:43:37 CEST 2010


Hello List,

I have a class that does some work, and this work runs on internal threads.
In order to keep the user informed of the progress of each instance I
thought that by using a Model based QTableView I could eliminate some of the
hard work.

What I want to do a to create a QMap < int, Worker * > where the int is the
row number in view and the Worker * is an instance my class that does all
the hard work. However, what I can't get my head round (assuming it is even
possible) is how do I display the Worker's internal member variable values
in the grid? (as some of these are updated by the internal processes).

So assuming for example my QMap contained wto entries what I'd want to see
in the QTableView are two rows by x rows (with headers). Column 0 would
display the name of the file currently being processed, the next column
would display the number of lines to process in this file, the third column
would display the number of rows processed so far.

Is this even possible, or is it the Worker that needs to be a derivative of
QAbstractTable | Item Model I have googled of course but I've not found
anythign that comes close.

-- 
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100630/944a2ecf/attachment.html 


More information about the Qt-interest-old mailing list