1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Enable maps drag&drop

This commit is contained in:
Martin Tůma 2020-12-08 01:12:39 +01:00
parent 73021bec01
commit 4bad086152

View File

@ -1834,9 +1834,25 @@ void GUI::dragEnterEvent(QDragEnterEvent *event)
void GUI::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
for (int i = 0; i < urls.size(); i++)
openFile(urls.at(i).toLocalFile());
MapAction *lastReady = 0;
QList<QUrl> urls(event->mimeData()->urls());
for (int i = 0; i < urls.size(); i++) {
QString file(urls.at(i).toLocalFile());
if (!openFile(file, true)) {
MapAction *a;
if (!loadMap(file, a, true))
openFile(file, false);
else {
if (a)
lastReady = a;
}
}
}
if (lastReady)
lastReady->trigger();
event->acceptProposedAction();
}