forked from engor/Jentos.Code
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtabwidgetdrop.cpp
executable file
·40 lines (32 loc) · 925 Bytes
/
tabwidgetdrop.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Jentos IDE.
Copyright 2014, Evgeniy Goroshkin.
See LICENSE.TXT for licensing terms.
*/
#include "tabwidgetdrop.h"
TabWidgetDrop::TabWidgetDrop(QWidget *parent) :
QTabWidget(parent)
{
}
void TabWidgetDrop::dropEvent(QDropEvent *e) {
const QMimeData *mimeData = e->mimeData();
if (mimeData->hasUrls()) {
QStringList pathList;
QList<QUrl> urlList = mimeData->urls();
for (int i = 0; i < urlList.size() && i < 32; ++i) {
pathList.append(urlList.at(i).toLocalFile());
qDebug() << "file: "+urlList.at(i).toLocalFile();
}
e->acceptProposedAction();
emit dropFiles(pathList);
}
}
void TabWidgetDrop::dragEnterEvent(QDragEnterEvent* e) {
e->acceptProposedAction();
}
void TabWidgetDrop::dragMoveEvent(QDragMoveEvent* e) {
e->acceptProposedAction();
}
void TabWidgetDrop::dragLeaveEvent(QDragLeaveEvent* e) {
e->accept();
}