Dropping project blocks other programs (like file explorer).

We have to delay or drop event handling, so the Qt code that delivers
the event can return control. The commit also prevents dropping another
file while we are currently already handling a drop.

Task-number: QTCREATORBUG-3344
This commit is contained in:
con
2010-12-10 14:49:06 +01:00
parent 34019eaf31
commit 506fb9e166
2 changed files with 16 additions and 2 deletions

View File

@@ -401,7 +401,7 @@ static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0)
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (isDesktopFileManagerDrop(event->mimeData())) {
if (isDesktopFileManagerDrop(event->mimeData()) && m_filesToOpenDelayed.isEmpty()) {
event->accept();
} else {
event->ignore();
@@ -413,12 +413,23 @@ void MainWindow::dropEvent(QDropEvent *event)
QStringList files;
if (isDesktopFileManagerDrop(event->mimeData(), &files)) {
event->accept();
openFiles(files, ICore::SwitchMode);
m_filesToOpenDelayed.append(files);
QTimer::singleShot(50, this, SLOT(openDelayedFiles()));
} else {
event->ignore();
}
}
void MainWindow::openDelayedFiles()
{
if (m_filesToOpenDelayed.isEmpty())
return;
activateWindow();
raise();
openFiles(m_filesToOpenDelayed, ICore::SwitchMode);
m_filesToOpenDelayed.clear();
}
IContext *MainWindow::currentContextObject() const
{
return m_activeContext;