mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 03:42:09 +01:00
Added support for drag&drop
This commit is contained in:
parent
09631de5a2
commit
9d90b97ba3
23
src/gui.cpp
23
src/gui.cpp
@ -18,6 +18,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QMimeData>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
@ -1173,6 +1174,28 @@ void GUI::closeEvent(QCloseEvent *event)
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
{
|
||||||
|
if (!event->mimeData()->hasUrls())
|
||||||
|
return;
|
||||||
|
if (event->proposedAction() != Qt::CopyAction)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QList<QUrl> urls = event->mimeData()->urls();
|
||||||
|
for (int i = 0; i < urls.size(); i++)
|
||||||
|
if (!urls.at(i).isLocalFile())
|
||||||
|
return;
|
||||||
|
|
||||||
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::dropEvent(QDropEvent *event)
|
||||||
|
{
|
||||||
|
QList<QUrl> urls = event->mimeData()->urls();
|
||||||
|
for (int i = 0; i < urls.size(); i++)
|
||||||
|
openFile(urls.at(i).toLocalFile());
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::writeSettings()
|
void GUI::writeSettings()
|
||||||
{
|
{
|
||||||
QSettings settings(APP_NAME, APP_NAME);
|
QSettings settings(APP_NAME, APP_NAME);
|
||||||
|
@ -110,6 +110,8 @@ private:
|
|||||||
|
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
void dropEvent(QDropEvent *event);
|
||||||
|
|
||||||
QToolBar *_fileToolBar;
|
QToolBar *_fileToolBar;
|
||||||
QToolBar *_showToolBar;
|
QToolBar *_showToolBar;
|
||||||
|
@ -26,6 +26,7 @@ PathView::PathView(QWidget *parent)
|
|||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setRenderHints(QPainter::Antialiasing);
|
setRenderHints(QPainter::Antialiasing);
|
||||||
|
setAcceptDrops(false);
|
||||||
|
|
||||||
_mapScale = new ScaleItem();
|
_mapScale = new ScaleItem();
|
||||||
_mapScale->setZValue(2.0);
|
_mapScale->setZValue(2.0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user