Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Action on a video while in FullScreen
Qt 6.11 is out! See what's new in the release blog

Action on a video while in FullScreen

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 512 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brioche
    wrote on last edited by
    #1

    Hi.

    I try to develop a little video player with Qt by using QMediaPlayer and QVideoWidget (amongst other).
    One of the feature is to be capable of playing and pausing the video by using the spacebar Key. It works very well into the main window but when I set the Video Widget to be fullscreen by double clicking it, the spacebar shortcut doesn't work.

    The spacebar event implementation is generated into my MainWindow (inherits of QMainWindow) class while videowidget's fullscreen settings are handled into my VideoWidget class which inherits of QVideoWidget.

    Is there any way to set the action of the QMediaPlayer to the fullscreen video widget ?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      When in fullscreen mode, QVideoWidget is a separate window, not a child widget of your MainWindow, so the key events won't be passed to the MainWindow.
      You can:

      1. Also add spacebar event implementation to your VideoWidget class.
      2. If you don't have other window in your application, then instead of handling key event, you can use QAction / QShortcut with ApplicationShortcut context.
      1 Reply Last reply
      3
      • B Offline
        B Offline
        Brioche
        wrote on last edited by
        #3

        That's what I thought.

        In the end, I've added the spacebar event implementation like you said but it's kind of dirty since the builder of VideoWidget now call a QMediaPlayer object within it to handle the play/pause signals.
        It works, but I don't like this architecture. So I'll try to regroup all the functionality of the VideoWidget (reading and rendering) within a widget that I'll add to the main window.

        Anyway, thanks for your answer !

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved