I have a QWidget inside a QMainWindow. When someone pressed the F11 key, the widget have to switch to fullscreen. When the F11 key is pressed again, I want to get that widget back into his normal Window state.
I'm using PyQT:
def toggleFullScreen(self):
if self.parent.ui.videoframe.isFullScreen() :
debug().info("Fullscreen mode: off")
self.parent.ui.videoframe.setWindowState(Qt.WindowNoState)
self.parent.ui.videoframe.setWindowFlags(Qt.Widget);
self.parent.ui.show()
else:
debug().info("Fullscreen mode: on")
self.parent.ui.videoframe.setWindowFlags(Qt.Window);
self.parent.ui.videoframe.setWindowState(Qt.WindowFullScreen)
self.parent.ui.videoframe.show()
def toggleFullScreen(self):
if self.parent.ui.videoframe.isFullScreen() :
debug().info("Fullscreen mode: off")
self.parent.ui.videoframe.setWindowState(Qt.WindowNoState)
self.parent.ui.videoframe.setWindowFlags(Qt.Widget);
self.parent.ui.show()
else:
debug().info("Fullscreen mode: on")
self.parent.ui.videoframe.setWindowFlags(Qt.Window);
self.parent.ui.videoframe.setWindowState(Qt.WindowFullScreen)
self.parent.ui.videoframe.show()
To copy to clipboard, switch view to plain text mode
When I set the Qt.Window flag, fullscreen will work. But now the event filter on the MainApplication won't receive QEvents anymore because (I guess) the mainwindow isn't on top.
"self.parent" is the main application class.
"videoframe" is the widget
How can I solve this?
Thanks!
Edit
Of course! I had to install a event filter on the videoframe widget. But I have to keep the eventfilter from the mainapplication because the the videoframe wiget doesn't receive QEvents when it's a normal widget. But now when I press F11 on fullscreen state, the event filter from the main application will also receive that event.
So I've got a new problem.
edit 2
Stupid me, self.parent.ui.show() had to be self.parent.ui.videoframe.show()
This problem is solved
Bookmarks