Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:49:46+00:00 2026-05-29T11:49:46+00:00

I have simple drag and drop functions implemented in QmainWindow the reference taken from

  • 0

I have simple drag and drop functions implemented in QmainWindow the reference taken from here and here
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 stocked 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() != QDialog::Accepted)
        {
                     
        }
}

when i remove the call to the QDialog , so every thing is working fine .
and the browser doesn’t stuck. i even tryed as suggested using signal/slot put again
when i start the QDialog when drop invoked the browser stucked!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:49:47+00:00Added an answer on May 29, 2026 at 11:49 am

    What exactly is PublishToDialog? I would assume that it is a custom dialog implementation of yours that inherits QDialog. And given this line:

    pPublishToDialog->exec() != QDialog::Accepted
    

    This opens the dialog as a modal dialog. A modal dialog is blocking and will block the execution of the current thread until some action is performed on the dialog. Instead of using a modal dialog, you should use a non-modal dialog. Since I am still not sure if PublishToDialog inherits QDialog or what else, I am just going to assume it is. Here is what you could do:

    PublishToDialog* pPublishToDialog = new PublishToDialog(this);
    
    // Make it a non-modal dialog
    pPublishDialog->setModal(false);
    
    // Connect it to a slot to handle whenever the user performs some action on it
    QObject::connect(pPublishDialog, SIGNAL(finished()), this, SLOT(handleDialogAction());
    pPublishDialog.show();
    

    You will have to implement handleDialogAction in your code. At the same time, you may want to make pPublishDialog a class-member as you will need it to access QDialog::reuslt in handleDialogAction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to do a simple drag-drop using jQuery. I have not done anything
We have implemented a drag and drop feature that shows a nice simple representation
I have, what should be, a simple question on drag'n'drop. I have a fresh
I have a web page where I have built a simple drag and drop
I'm building a simple 3D drag and drop interface in processing, and want to
I have implemented the JQuery Drag and Drop plug in into my web site.
i have what i thought would be a simple drag and drop I can't
I try to do simple drag'n'drop (drag file to text area). I implemented drag'n'drop
I have a very simple application test in which I want to drag and
I have simple SSIS package which reads data from flat file and insert into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.