Firefox Browser stuck when droping link to QMainWindow



  • I have simple drag and drop functions implemented in QmainWindow the reference taken
    from "here":http://sector.ynet.sk/qt4-tutorial/dnd.html
    and
    "here":http://developer.qt.nokia.com/wiki/Drag_and_Drop_of_files
    all i want to do is to accept valid url and open QDialog when the url dropped .
    but when the url drooped and the QDialog poped up the browser is stuck in the background until i close the QDialog . this is wrong the browser should be free all the time.
    here is my code :

    @void MainWindow::dragMoveEvent(QDragMoveEvent *event)
    {

     if (event->mimeData()->hasFormat("text/html")) 
      {  
      event->acceptProposedAction();
      }
     else
     {
      event->ignore();
     }
    }
    void MainWindow::dragEnterEvent(QDragEnterEvent *event)
    {
     // accept just text/uri-list mime format
     if (event->mimeData()->hasFormat("text/html"))
      {  
      event->acceptProposedAction();
      } 
     else
     {
      event->ignore();
     }
    }
    void MainWindow::dragLeaveEvent(QDragLeaveEvent *event)
    {
       
         event->accept();
    
     
    }
    void MainWindow::dropEvent(QDropEvent *event)
    {
     QList<QUrl> urlList;
     QString fName;
     QStringList pathList;
     QFileInfo info;
     QString suffix;
        
      if (event->mimeData()->hasFormat("text/html"))
      {
       urlList = event->mimeData()->urls(); // returns list of QUrls
       // if just text was dropped, urlList is empty (size == 0)
       
       if ( urlList.size() > 0) // if at least one QUrl is present in list
       {
         QString url = urlList.at(0).toString();
         event->acceptProposedAction();
         openDialog(url); // THIS IS THE FUNCTION THAT I OPEN THE QDIALOG window 
         
          
       }
      }
      //event->acceptProposedAction();
    }
    
    void MainWindow::openDialog(QString& slink)
    {
     
      QHash<QString,QVariant> DataMap;    
      QString link = slink;
      DataMap.insert("m_webpage",link);
       
      PublishToDialog* pPublishToDialog = new PublishToDialog(this);
      pPublishToDialog->Init(DataMap);
      if(pPublishToDialog->exec&#40;&#41; != QDialog::Accepted)
      {
          
      }
    }@

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.