-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileLine.cpp
More file actions
41 lines (40 loc) · 773 Bytes
/
FileLine.cpp
File metadata and controls
41 lines (40 loc) · 773 Bytes
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
41
#include "FileLine.h"
bool iswindows()
{
#ifdef Q_OS_WINDOWS
return true;
#else
return false;
#endif
}
FileLine::FileLine(QWidget *parent):QLineEdit(parent)
{
setAcceptDrops(true);
}
QString FileLine::getvalue()
{
return Filepath;
}
bool FileLine::operator()(QString& name)
{
QFileInfo file(name);
if(file.isFile())
return true;
else
return false;
}
void FileLine::dragEnterEvent(QDragEnterEvent* e)
{
e->accept();
}
void FileLine::dropEvent(QDropEvent* e)
{
QString path;
if(iswindows())
path=e->mimeData()->text().replace("file:///","");
else
path=e->mimeData()->text().replace("file://","");
setText(path);
Filepath=path;
emit changed();
}