DecebalICT

Importing with a seperate thread

Feb 21st, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.60 KB | None | 0 0
  1. The class used:
  2.     private class ProcessFile(filename : String) extends Runnable {
  3.  
  4. The function to do the work in a separate thread:
  5.         private def importQuotes() {
  6.             val quotesFile = QFileDialog.getOpenFileName(this, "Citaten bestand", QDir.currentPath())
  7.  
  8.             if (quotesFile != "") {
  9.                 val processFile = new ProcessFile(quotesFile)
  10.                 val runner      = new QThread(processFile)
  11.  
  12.                 importButton.setEnabled(false)
  13.                 runner.finished.connect(this, "enableImport()")
  14.                 runner.start
  15.             }
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment