1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-12-02 23:49:09 +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) void GUI::dropEvent(QDropEvent *event)
{ {
QList<QUrl> urls = event->mimeData()->urls(); MapAction *lastReady = 0;
for (int i = 0; i < urls.size(); i++) QList<QUrl> urls(event->mimeData()->urls());
openFile(urls.at(i).toLocalFile());
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(); event->acceptProposedAction();
} }