0

I am loading a csv file using QFileDialog and displaying it on a qtableview . This loading process takes a lot of time. How do I indicate to the user that he has to wait till the file is getting loaded using qstatusbar or qprogressbar?

annie
  • 143
  • 1
  • 1
  • 11
  • What's your code to load that `.csv` file? You could probably add a callback to update a progress bar. – user0042 Aug 21 '17 at 17:52
  • You should implement a non-blocking worker https://stackoverflow.com/questions/32952474/non-blocking-worker-interrupt-file-copy – dtech Aug 21 '17 at 18:12

1 Answers1

-1

You can find an example of a working QProgressBar here. In the Qt forum, we had a great discussion about how to get it properly working. However, to be able to show the progress you need to know how many lines there are in the file. So far I have not found any other option than to read the whole file and count how many lines are there. This, getting the total number of lines in a file, was discussed in this stackoverflow topic. One option, if you are first generating this file and then reading it, is to add a header telling you how much information is there, then you will be able to do the QProgressDialog part.

I hope it helped!

apalomer
  • 1,895
  • 14
  • 36