Skip to content

Commit 373ac45

Browse files
committed
Slightly cleanup drop handling in qgisapp
1 parent c5ae3a0 commit 373ac45

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

src/app/qgisapp.cpp

+17-22
Original file line numberDiff line numberDiff line change
@@ -1392,40 +1392,35 @@ void QgisApp::dropEvent( QDropEvent *event )
13921392
files << fileName;
13931393
}
13941394
}
1395-
timer->setProperty( "files", files );
13961395

13971396
QgsMimeDataUtils::UriList lst;
13981397
if ( QgsMimeDataUtils::isUriList( event->mimeData() ) )
13991398
{
14001399
lst = QgsMimeDataUtils::decodeUriList( event->mimeData() );
14011400
}
1402-
timer->setProperty( "uris", QVariant::fromValue( lst ) );
14031401

1404-
connect( timer, &QTimer::timeout, this, &QgisApp::dropEventTimeout );
1402+
connect( timer, &QTimer::timeout, this, [this, timer, files, lst]
1403+
{
1404+
freezeCanvases();
14051405

1406-
event->acceptProposedAction();
1407-
timer->start();
1408-
}
1406+
for ( const QString &file : qgsAsConst( files ) )
1407+
{
1408+
openFile( file );
1409+
}
14091410

1410-
void QgisApp::dropEventTimeout()
1411-
{
1412-
freezeCanvases();
1413-
QStringList files = sender()->property( "files" ).toStringList();
1414-
sender()->deleteLater();
1411+
if ( !lst.isEmpty() )
1412+
{
1413+
handleDropUriList( lst );
1414+
}
14151415

1416-
Q_FOREACH ( const QString &file, files )
1417-
{
1418-
openFile( file );
1419-
}
1416+
freezeCanvases( false );
1417+
refreshMapCanvas();
14201418

1421-
QgsMimeDataUtils::UriList lst = sender()->property( "uris" ).value<QgsMimeDataUtils::UriList>();
1422-
if ( !lst.isEmpty() )
1423-
{
1424-
handleDropUriList( lst );
1425-
}
1419+
timer->deleteLater();
1420+
} );
14261421

1427-
freezeCanvases( false );
1428-
refreshMapCanvas();
1422+
event->acceptProposedAction();
1423+
timer->start();
14291424
}
14301425

14311426
void QgisApp::annotationCreated( QgsAnnotation *annotation )

src/app/qgisapp.h

-3
Original file line numberDiff line numberDiff line change
@@ -1506,9 +1506,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
15061506
//! Set the layer for the map style dock. Doesn't show the style dock
15071507
void setMapStyleDockLayer( QgsMapLayer *layer );
15081508

1509-
//! Handles processing of dropped mimedata
1510-
void dropEventTimeout();
1511-
15121509
void annotationCreated( QgsAnnotation *annotation );
15131510

15141511
void updateCrsStatusBar();

0 commit comments

Comments
 (0)