-
Notifications
You must be signed in to change notification settings - Fork 0
/
dropwidget.cpp
67 lines (54 loc) · 1.35 KB
/
dropwidget.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "dropwidget.h"
#include<QWidget>
#include<QUrl>
#include <QtGui>
DropWidget::DropWidget(QWidget *parent) :
Phonon::VideoWidget(parent)
{
setAcceptDrops(true);
//setAttribute(Qt::WA_TransparentForMouseEvents);
setCursor(Qt::BlankCursor);
setFocus();
}
void DropWidget::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasUrls())
event->acceptProposedAction();
}
void DropWidget::dragMoveEvent(QDragMoveEvent *event)
{
event->acceptProposedAction();
}
void DropWidget::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
emit geturls(event->mimeData());
}
void DropWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
if(event->type()==QEvent::MouseButtonDblClick)
{
if(!this->isFullScreen())
this->setFullScreen(true);
else
this->setFullScreen(false);
}
}
void DropWidget::mouseMoveEvent(QMouseEvent *event)
{
if(event->type()==QEvent::MouseMove&&this->isFullScreen())
{
setCursor(Qt::BlankCursor);
}
else if(event->type()==QEvent::MouseMove&&!this->isFullScreen())
{
if(this->cursor().shape()==Qt::BlankCursor)
setCursor(Qt::ArrowCursor);
else
setCursor(Qt::BlankCursor);
}
}
void DropWidget::keyPressEvent(QKeyEvent *event)
{
emit capturespace(event);
}