Quote Originally Posted by d_stranz View Post
In the constructor, you set the column count for your model to 2.

In the code you just posted, you are creating a list that (is supposed to) contain one item for every file in your directory. You then (think you) are appending -one- row for each of those file names. There could 100 of them, almost certainly more than 2.

But that's not what your code is doing. In the code you posted above, you create -one- QStandardItem and use it over and over again for each filename. After you exit the loop, your -one- QStandardItem contains the name of the -last- filename. You then push that onto the list, and that list now contains only -one- item. So you add one row to the table, and it contains only the filename in the first column.

Your code should be doing this:

Qt Code:
  1. for each file: (all this code is inside the foreach loop)
  2. {
  3. - create the (empty) list
  4. - create a QStandardItem
  5. - set the text for that item to the file name
  6. - push that item onto the list
  7. - create a second QStandardItem
  8. - retrieve the status for the file
  9. - set that text on the second item
  10. - push the second item onto the list
  11. - append a row to the table using that two item list
  12. }
To copy to clipboard, switch view to plain text mode 

And PLEASE use CODE tags when posting code. Your posts are almost completely unreadable without them. See my signature below to learn how to do that.
Thanks it works...