sort've implies that you need to read the csv file, and store the row count. Each time row count is called check if the csv has been updated somehow and re-cache the row count.
sort've implies that you need to read the csv file, and store the row count. Each time row count is called check if the csv has been updated somehow and re-cache the row count.
akshaysulakhe (19th July 2013)
The column count is known once you read the first record of the CSV file.
You can read the entire CSV file to determine a total row count. For a small file this is probably easiest.
Alternatively, implement a lazy fetching mechanism where you read rows in sets of up to n rows and return rowCount() of the number actually read to date. On open/reset the model reads up to n rows and rowCount() returns the number read. Implement canFetchMore() and fetchMore() to allow views to see the entire table if required. QSqlTableModel uses this approach with n == 256.
akshaysulakhe (19th July 2013)
Thank You guys, the CSV file is not that big. This will work. Ty :-)
Bookmarks