-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoWidget.cpp
More file actions
55 lines (49 loc) · 1023 Bytes
/
VideoWidget.cpp
File metadata and controls
55 lines (49 loc) · 1023 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "VideoWidget.h"
#include <QMouseEvent>
#include <QDebug>
#include <QPainter>
VideoWidget::VideoWidget(QWidget *parent)
: QVideoWidget(parent)
{
}
VideoWidget::~VideoWidget()
{
}
//鼠标移动事件
void VideoWidget::mouseMoveEvent(QMouseEvent * event)
{
if (isFullScreen()) {
if (event->pos().y() + 200 > this->frameSize().rheight()) {
emit showMenu();
}
}
}
//鼠标双击事件
void VideoWidget::mouseDoubleClickEvent(QMouseEvent * event)
{
if (isFullScreen()) {
setFullScreen(false);
emit hideMeun();
emit hideFull();
}
else {
setFullScreen(true);
emit showFull();
}
}
//按键按下事件
void VideoWidget::keyPressEvent(QKeyEvent * event)
{
if (event->key() == Qt::Key_Up) {
emit keyPress(event->key());
}
else if (event->key() == Qt::Key_Down) {
emit keyPress(event->key());
}
else if (event->key() == Qt::Key_Left) {
emit keyPress(event->key());
}
else if (event->key() == Qt::Key_Right) {
emit keyPress(event->key());
}
}