Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
d278550e
Commit
d278550e
authored
May 18, 2018
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt: handle video widget cursor automatically (refs #18661)
parent
a21fc097
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
modules/gui/qt/components/interface_widgets.cpp
modules/gui/qt/components/interface_widgets.cpp
+21
-0
modules/gui/qt/components/interface_widgets.hpp
modules/gui/qt/components/interface_widgets.hpp
+7
-0
modules/gui/qt/main_interface.cpp
modules/gui/qt/main_interface.cpp
+0
-14
modules/gui/qt/main_interface.hpp
modules/gui/qt/main_interface.hpp
+0
-2
No files found.
modules/gui/qt/components/interface_widgets.cpp
View file @
d278550e
...
...
@@ -88,6 +88,12 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i, QWidget* p_parent )
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
stable
=
NULL
;
p_window
=
NULL
;
cursorTimer
=
new
QTimer
(
this
);
cursorTimer
->
setSingleShot
(
true
);
connect
(
cursorTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
hideCursor
())
);
cursorTimeout
=
var_InheritInteger
(
_p_i
,
"mouse-hide-timeout"
);
show
();
}
...
...
@@ -297,6 +303,17 @@ void VideoWidget::resizeEvent( QResizeEvent *event )
reportSize
();
}
void
VideoWidget
::
hideCursor
()
{
setCursor
(
Qt
::
BlankCursor
);
}
void
VideoWidget
::
showCursor
()
{
setCursor
(
Qt
::
ArrowCursor
);
cursorTimer
->
start
(
cursorTimeout
);
}
int
VideoWidget
::
qtMouseButton2VLC
(
Qt
::
MouseButton
qtButton
)
{
if
(
p_window
==
NULL
)
...
...
@@ -320,6 +337,7 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event )
if
(
vlc_button
>=
0
)
{
vout_window_ReportMouseReleased
(
p_window
,
vlc_button
);
showCursor
();
event
->
accept
();
}
else
...
...
@@ -332,6 +350,7 @@ void VideoWidget::mousePressEvent( QMouseEvent* event )
if
(
vlc_button
>=
0
)
{
vout_window_ReportMousePressed
(
p_window
,
vlc_button
);
showCursor
();
event
->
accept
();
}
else
...
...
@@ -350,6 +369,7 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event )
current_pos
*=
devicePixelRatio
();
#endif
vout_window_ReportMouseMoved
(
p_window
,
current_pos
.
x
(),
current_pos
.
y
()
);
showCursor
();
event
->
accept
();
}
else
...
...
@@ -362,6 +382,7 @@ void VideoWidget::mouseDoubleClickEvent( QMouseEvent *event )
if
(
vlc_button
>=
0
)
{
vout_window_ReportMouseDoubleClick
(
p_window
,
vlc_button
);
showCursor
();
event
->
accept
();
}
else
...
...
modules/gui/qt/components/interface_widgets.hpp
View file @
d278550e
...
...
@@ -47,6 +47,7 @@
class
QMenu
;
class
QSlider
;
class
QTimer
;
class
QWidgetAction
;
class
SpeedControlWidget
;
struct
vout_window_t
;
...
...
@@ -84,14 +85,20 @@ private:
QWidget
*
stable
;
QLayout
*
layout
;
QTimer
*
cursorTimer
;
int
cursorTimeout
;
void
reportSize
();
void
showCursor
();
signals:
void
sizeChanged
(
int
,
int
);
public
slots
:
void
setSize
(
unsigned
int
,
unsigned
int
);
private
slots
:
void
hideCursor
();
};
/******************** Background Widget ****************/
...
...
modules/gui/qt/main_interface.cpp
View file @
d278550e
...
...
@@ -222,8 +222,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT
(
this
,
askVideoSetFullScreen
(
bool
),
this
,
setVideoFullScreen
(
bool
)
);
CONNECT
(
this
,
askHideMouse
(
bool
),
this
,
setHideMouse
(
bool
)
);
}
CONNECT
(
THEDP
,
toolBarConfUpdated
(),
this
,
toolBarConfUpdated
()
);
...
...
@@ -930,11 +928,6 @@ void MainInterface::setVideoFullScreen( bool fs )
videoWidget
->
sync
();
}
void
MainInterface
::
setHideMouse
(
bool
hide
)
{
videoWidget
->
setCursor
(
hide
?
Qt
::
BlankCursor
:
Qt
::
ArrowCursor
);
}
/* Slot to change the video always-on-top flag.
* Emit askVideoOnTop() to invoke this from other thread. */
void
MainInterface
::
setVideoOnTop
(
bool
on_top
)
...
...
@@ -1000,13 +993,6 @@ int MainInterface::controlVideo( int i_query, va_list args )
emit
askVideoSetFullScreen
(
b_fs
);
return
VLC_SUCCESS
;
}
case
VOUT_WINDOW_HIDE_MOUSE
:
{
bool
b_hide
=
va_arg
(
args
,
int
);
emit
askHideMouse
(
b_hide
);
return
VLC_SUCCESS
;
}
default:
msg_Warn
(
p_intf
,
"unsupported control query"
);
return
VLC_EGENERIC
;
...
...
modules/gui/qt/main_interface.hpp
View file @
d278550e
...
...
@@ -262,7 +262,6 @@ protected slots:
void
setVideoSize
(
unsigned
int
,
unsigned
int
);
void
videoSizeChanged
(
int
,
int
);
virtual
void
setVideoFullScreen
(
bool
);
void
setHideMouse
(
bool
);
void
setVideoOnTop
(
bool
);
void
setBoss
();
void
setRaise
();
...
...
@@ -279,7 +278,6 @@ signals:
void
askReleaseVideo
(
);
void
askVideoToResize
(
unsigned
int
,
unsigned
int
);
void
askVideoSetFullScreen
(
bool
);
void
askHideMouse
(
bool
);
void
askVideoOnTop
(
bool
);
void
minimalViewToggled
(
bool
);
void
fullscreenInterfaceToggled
(
bool
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment