Skip to content
Permalink
Browse files

Slightly cleanup drop handling in qgisapp

  • Loading branch information
nyalldawson committed Sep 15, 2017
1 parent c5ae3a0 commit 373ac4537bc183f851998866b291f907b812f76b
Showing with 17 additions and 25 deletions.
  1. +17 −22 src/app/qgisapp.cpp
  2. +0 −3 src/app/qgisapp.h
@@ -1392,40 +1392,35 @@ void QgisApp::dropEvent( QDropEvent *event )
files << fileName;
}
}
timer->setProperty( "files", files );

QgsMimeDataUtils::UriList lst;
if ( QgsMimeDataUtils::isUriList( event->mimeData() ) )
{
lst = QgsMimeDataUtils::decodeUriList( event->mimeData() );
}
timer->setProperty( "uris", QVariant::fromValue( lst ) );

connect( timer, &QTimer::timeout, this, &QgisApp::dropEventTimeout );
connect( timer, &QTimer::timeout, this, [this, timer, files, lst]
{
freezeCanvases();

event->acceptProposedAction();
timer->start();
}
for ( const QString &file : qgsAsConst( files ) )
{
openFile( file );
}

void QgisApp::dropEventTimeout()
{
freezeCanvases();
QStringList files = sender()->property( "files" ).toStringList();
sender()->deleteLater();
if ( !lst.isEmpty() )
{
handleDropUriList( lst );
}

Q_FOREACH ( const QString &file, files )
{
openFile( file );
}
freezeCanvases( false );
refreshMapCanvas();

QgsMimeDataUtils::UriList lst = sender()->property( "uris" ).value<QgsMimeDataUtils::UriList>();
if ( !lst.isEmpty() )
{
handleDropUriList( lst );
}
timer->deleteLater();
} );

freezeCanvases( false );
refreshMapCanvas();
event->acceptProposedAction();
timer->start();
}

void QgisApp::annotationCreated( QgsAnnotation *annotation )
@@ -1506,9 +1506,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Set the layer for the map style dock. Doesn't show the style dock
void setMapStyleDockLayer( QgsMapLayer *layer );

//! Handles processing of dropped mimedata
void dropEventTimeout();

void annotationCreated( QgsAnnotation *annotation );

void updateCrsStatusBar();

0 comments on commit 373ac45

Please sign in to comment.
You can’t perform that action at this time.