Using QVideoWidget in PySide2 (although the python part may not be significant). I've set up my hotkeys using QShortcut, and it all works great. When I press 'F' to enter full-screen mode that works too, but then I can't leave. None of my hotkeys or mouse event handlers work. I end up stuck in full-screen mode.
Is there a way to allow it to respond even in full-screen mode? Have I gone about creating my hotkeys the wrong way?
This example demonstrates the issue:
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self._fullscreen = False
self.movie_display = QVideoWidget(self)
self.movie_handler = QMediaPlayer()
self.movie_handler.setVideoOutput(self.movie_display)
layout = QVBoxLayout()
layout.addWidget(self.movie_display)
self.setLayout(layout)
QShortcut(QKeySequence(QtConsts.Key_F), self, self.toggle_fullscreen)
s = 'test.webm'
s = os.path.join(os.path.dirname(__file__), s)
local = QUrl.fromLocalFile(s)
media = QMediaContent(local)
self.movie_handler.setMedia(media)
self.movie_handler.play()
def toggle_fullscreen(self):
self._fullscreen = not self._fullscreen
self.movie_display.setFullScreen(self._fullscreen)