Hello,

I am writing an app in QT4.5 and the application is dialog based. The purpose of the app is to load in an error file, and parse the information to the user using a textview, which displays the end result in a html formatted view. The user also has push buttons to allow the error file to be exported as text, (it is imported as a bin file...), exported as a .csv formatted file and to allow the user to view the time stamps when all of the errors occured. My problem is with the timestamp part of the application.

I am using a QTreeWidget with QTreeWidgetItem which is called when the user presses the timestamps button. This will open the tree view in its own window, via a call to treeWidget->show(). With smaller files, everything works quite well, but, with larger files, say, 3 Mb in size, the treeWidget takes about 20 seconds before the formatted data is shown to the user. If your patient, not a problem, but I need some way of indicating to the user that the process is in fact occuring. I tried using a QProgressDialog as shown below, but the dialog is never shown to the user, and the treeWidget is not shown either until it has finished parsing the data.

How my tree widgets and progress dialog are called:

Qt Code:
  1. QTreeWidget *treeWidget = new QTreeWidget();
  2. treeWidget->setMinimumSize(650, 400); // int width, int height
  3. treeWidget->setColumnCount(3);
  4. treeWidget->setAlternatingRowColors(true);
  5.  
  6. QStringList headerLabels;
  7. headerLabels << "System Error Messages " << "Time Stamp: HH:MM:SS" << "Parameter";
  8. treeWidget->setHeaderLabels(headerLabels);
  9. treeWidget->resizeColumnToContents(1);
  10. treeWidget->setColumnWidth(0, 325);
  11. treeWidget->setWindowTitle(tr("Error Time Stamps"));
  12. treeWidget->setWindowIcon(QIcon(":/images/My.ico"));
  13.  
  14. QProgressDialog *infProg = new QProgressDialog("Parsing Time Records...",0,0,0,this);
  15. infProg->setRange(0,0);
  16. infProg->setWindowModality(Qt::WindowModal);
  17. QApplication::processEvents();
  18.  
  19. .... more code...
  20. // and this is how the widget is displayed
  21.  
  22. infProg->setAutoClose(true);
  23.  
  24. treeWidget->show();
To copy to clipboard, switch view to plain text mode 

My question is, how would I show the progress dialog while the tree view is doing its thing in the background??

Thanks!