Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Exit full screen in WebEngineView QtQuick
Forum Updated to NodeBB v4.3 + New Features

Exit full screen in WebEngineView QtQuick

Scheduled Pinned Locked Moved Solved QtWebEngine
3 Posts 2 Posters 743 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.
  • T Offline
    T Offline
    The3DmaN
    wrote on last edited by The3DmaN
    #1

    Part of my QtQuick app will go fullscreen when the webpage requests it. I am able to successfully get into full screen when it is requested, however I seem to be unable to get out. I know I am doing something wrong. It seems to work initially and goes to my "else" and becomes fullscreen, but when I click the fullscreen web button again it does not seem to run again and exit fullscreen. Any help or guidance would be appreciated. The full code can be found here: https://gitlab.com/The3DmaN/media-server-connect

    mediaserverconnect.ui.qml

    WebEngineView {
            id: webview
            anchors.fill: parent
            settings.allowWindowActivationFromJavaScript: false
            settings.javascriptCanOpenWindows: true
            settings.javascriptEnabled: true
            settings.webGLEnabled: true
            settings.fullScreenSupportEnabled: true
            settings.showScrollBars: false
            url: "http://" + ipsettings.ip + ":" + ipsettings.port
    
            Connections {
                target: webview
                onFullScreenRequested: {
                    if (webview.state == "FullScreen") {
                        webview.triggerWebAction(WebEngineView.ExitFullScreen)
                        window.showNormal()
                        toolBar.visible = true
                    } else {
                        webview.state = "FullScreen"
                        window.showFullScreen()
                        toolBar.visible = false
                    }
                }
            }
        }
    

    Other info: The webpage is an Emby server video page, and the fullscreen button gives off the below code (not my code)

    function() {
      playbackManager.toggleFullscreen(currentPlayer)
    }
    
    B 1 Reply Last reply
    0
    • T The3DmaN

      Part of my QtQuick app will go fullscreen when the webpage requests it. I am able to successfully get into full screen when it is requested, however I seem to be unable to get out. I know I am doing something wrong. It seems to work initially and goes to my "else" and becomes fullscreen, but when I click the fullscreen web button again it does not seem to run again and exit fullscreen. Any help or guidance would be appreciated. The full code can be found here: https://gitlab.com/The3DmaN/media-server-connect

      mediaserverconnect.ui.qml

      WebEngineView {
              id: webview
              anchors.fill: parent
              settings.allowWindowActivationFromJavaScript: false
              settings.javascriptCanOpenWindows: true
              settings.javascriptEnabled: true
              settings.webGLEnabled: true
              settings.fullScreenSupportEnabled: true
              settings.showScrollBars: false
              url: "http://" + ipsettings.ip + ":" + ipsettings.port
      
              Connections {
                  target: webview
                  onFullScreenRequested: {
                      if (webview.state == "FullScreen") {
                          webview.triggerWebAction(WebEngineView.ExitFullScreen)
                          window.showNormal()
                          toolBar.visible = true
                      } else {
                          webview.state = "FullScreen"
                          window.showFullScreen()
                          toolBar.visible = false
                      }
                  }
              }
          }
      

      Other info: The webpage is an Emby server video page, and the fullscreen button gives off the below code (not my code)

      function() {
        playbackManager.toggleFullscreen(currentPlayer)
      }
      
      B Offline
      B Offline
      Bob64
      wrote on last edited by Bob64
      #2

      @The3DmaN said in Exit full screen in WebEngineView QtQuick:

      fullScreenSupportEnabled

      I haven't used this myself, but from looking at the documentation, perhaps you need to call request.accept() at the end of your onFullScreenRequested handler.

      Also, you could use the request.toggleOn property to query the mode rather than the string comparison with webview.state that you currently use.

      T 1 Reply Last reply
      0
      • B Bob64

        @The3DmaN said in Exit full screen in WebEngineView QtQuick:

        fullScreenSupportEnabled

        I haven't used this myself, but from looking at the documentation, perhaps you need to call request.accept() at the end of your onFullScreenRequested handler.

        Also, you could use the request.toggleOn property to query the mode rather than the string comparison with webview.state that you currently use.

        T Offline
        T Offline
        The3DmaN
        wrote on last edited by The3DmaN
        #3

        @Bob64 Thanks so much! I think missing request.accept() was the issue. I also swapped to request.toggleOn.

        All working now with:

        onFullScreenRequested: {
                        if (request.toggleOn) {
                            window.showFullScreen()
                            toolBar.visible = false
                            request.accept()
           
                        } else {
                            window.showNormal()
                            toolBar.visible = true
                            request.accept()
                        }
                    }
        
        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