Hi! I have Widget MainWindow and tableWidget in MainWindow. tableWidget is placed in the center of MainWindow. I need drop audio-files on Main Window. If i drop files to MainWindow then do such function, if i drop files on table - do another function. Can you help me?

i try to realize drop on mainWindow:
in header:
Qt Code:
  1. void dragEnterEvent (QDragEnterEvent *pe){
  2. if (pe->mimeData()->hasFormat("text/uri-list")){
  3. pe->acceptProposedAction();
  4. }
  5. }
  6. void dropEvent (QDropEvent* pe);
To copy to clipboard, switch view to plain text mode 

in constructor

Qt Code:
  1. setAcceptDrops(true);
To copy to clipboard, switch view to plain text mode 

and

Qt Code:
  1. void MainWindow::dropEvent(QDropEvent *pe){
  2. QList<QUrl> urlList=pe->mimeData()->urls();
  3. foreach (QUrl url, urlList ){
  4. str<<url.toString();
  5. QMessageBox::information(this,"yeah",url.toString());
  6. }
  7. // Some function with str
  8. }
To copy to clipboard, switch view to plain text mode 

But i have crash on drop.