After reading Martin’s excellent book, looking through tutorials, building some UI’s, I must confess I’m missing something fundamental about navigating through the TableViews when they are showing large databases. I’m building an app for my son, a sociolinguist. These folks search through enormous amounts of data from social media looking for word patterns of interest. Currently we have a database of 668,000 rows, each containing a transcipt of up to 30 seconds of conversation, maximum 2K characters, average length of 80 characters.
The use case is to filter on phrases of interest, then when found, unfilter, and jump to the same record of interest so as to see the rest of the conversation around that phrase.
Finally, click a button that launches the youtube video and start it at that phrase. I have all that working, EXCEPT the jump to the same record upon filter change. Also, we need to save the user’s place and restore it when restarting the app. The user can spend days searching.
Qt automatically pages this large dataset beautifully, in 256 record chunks.
So I thought, ok, use model.match to find, say, the record where the UID = 1000. But match only searches through the 256 records currently being displayed. There are several use cases where I know the record key from the database (UID), and I need to find and display that record and surrounding records in the tableview.
If I had the index of the record, I could do table.setCurrentIndex(index). Ah, but how do I get the index? If I knew the row, I could do table.selectRow(), except that it, too, is limited to the 256 records in the current page. table.selectRow(1000) throws no error, but does nothing.
This is starting to sound like a job for a proxy model. Filter for the UID so there is only one row that matches, then get the matching index in the source model and do sourcetable.setCurrentIndex(the found index).
Surely it’s not that hard, and I’m missing something fundamental.
Please advise.
thanks in advance.