Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Firefox Browser stuck when droping link to QMainWindow
Qt 6.11 is out! See what's new in the release blog

Firefox Browser stuck when droping link to QMainWindow

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    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)
      {
          
      }
    }@
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved