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. QtWebEngine stops displaying when undocked

QtWebEngine stops displaying when undocked

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 1.2k Views 3 Watching
  • 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.
  • V Offline
    V Offline
    VirtualFloat
    wrote on last edited by VirtualFloat
    #1

    Situation:

    I have an application with a OpenGL widget for 3d visuals (QGLWidget) Next to that there is a QtWebEngine in a dock-widget.
    This works fine until the dock-widget is undocked/undocked. At that moment the WebEngine widget stops functioning.
    If the initial condition of the dock-widget is docked, then the contents will only be displayed when the widget is docked.
    If the initial condition of the dock-widget is floating, then the contents will only be displayed when the widget is floating.

    UGev91ijoB.gif .

    Maybe both QT and the html renderer are both trying to use the same hardware accelerated drawing routines and this fails when they are not in the same window....?

    Windows 10
    Qt 5.12.5
    PySide 5.13.2

    The code to reproduce is:

    from PySide2.QtWidgets import QMainWindow
    from PySide2 import QtCore, QtWidgets
    from PySide2.QtOpenGL import QGLWidget
    
    class Ui_MainWindow(object):
        def setupUi(self, MainWindow):
    
            self.frame3d = QGLWidget(MainWindow)
            MainWindow.setCentralWidget(self.frame3d)
    
            self.info_browser = QtWidgets.QDockWidget(MainWindow)
            self.info_browser.setObjectName("info_browser")
    
            self.dockWidgetContents = QtWidgets.QWidget()
            self.dockWidgetContents.setObjectName("dockWidgetContents")
    
            self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.dockWidgetContents)
    
            self.browser = QWebEngineView(self.dockWidgetContents)
            self.verticalLayout_6.addWidget(self.browser)
            self.info_browser.setWidget(self.dockWidgetContents)
    
            MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.info_browser)
    
            # self.info_browser.setFloating(True)
    
        def changed(self):
            print('changed')
    
    
    from PySide2.QtWebEngineWidgets import QWebEngineView
    from PySide2.QtWebEngine import QtWebEngine
    
    QtWebEngine.initialize()
    
    app = QtWidgets.QApplication()
    
    
    
    MainWindow = QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    
    
    html = "<html><body><H1>Hello, world</H1>When docked, this is displayed ok, when undocked I'm gone :-(</body></html>"
    
    ui.browser.setHtml(html)
    
    
    MainWindow.show()
    app.exec_()
    
    1 Reply Last reply
    0
    • eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @VirtualFloat In Linux I don't see the same problem but rather that the QDockWidget container creates a bad copy, I think the bug is caused by vtk since if I change self.frame3d = QVTKRenderWindowInteractor(MainWindow) to self.frame3d = QtWidgets.QWidget(MainWindow) the problem is no longer observed.

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VirtualFloat
        wrote on last edited by VirtualFloat
        #3

        @eyllanesc , thanks for looking into this.

        I did dig into the VTK code and it turn out that QVTKRenderWindowInteractor is derived from QGLWidget.

        When I replace QVTKRenderWindowInteractor with QGLWidget the problem remains unchanged. So the problem has to be within Qt.

        Updated the starting post accordingly.

        eyllanescE 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          How did you install PySide2 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • V VirtualFloat

            @eyllanesc , thanks for looking into this.

            I did dig into the VTK code and it turn out that QVTKRenderWindowInteractor is derived from QGLWidget.

            When I replace QVTKRenderWindowInteractor with QGLWidget the problem remains unchanged. So the problem has to be within Qt.

            Updated the starting post accordingly.

            eyllanescE Offline
            eyllanescE Offline
            eyllanesc
            wrote on last edited by
            #5

            @VirtualFloat What happens if you use QWidget instead of QGLWidget?

            If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

            V 1 Reply Last reply
            0
            • eyllanescE eyllanesc

              @VirtualFloat What happens if you use QWidget instead of QGLWidget?

              V Offline
              V Offline
              VirtualFloat
              wrote on last edited by VirtualFloat
              #6

              @eyllanesc With QWidget instead of QGLWidget everything works as it should

              @SGaist I installed pyside2 via conda-forge
              version 5.13.2
              qt came from conda-forge as well, version 5.12.5

              1 Reply Last reply
              0
              • eyllanescE Offline
                eyllanescE Offline
                eyllanesc
                wrote on last edited by eyllanesc
                #7

                @VirtualFloat It seems the problem is OpenGL. Try not using conda but using python + pip (I've seen several posts caused by conda bugs). In linux with the latest version provided by pip I don't see that problem

                If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  VirtualFloat
                  wrote on last edited by
                  #8

                  I'm working with a few different conda environments and I can not risk messing that up by installing qt using pip. I only have one windows PC, and I think a virtual desktop is not going to work here because opengl will be handled differently there.

                  mrjjM 1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi,

                    Use virtenv to create a classic python virtual environment and you won't have to mess with your conda installation.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • V VirtualFloat

                      I'm working with a few different conda environments and I can not risk messing that up by installing qt using pip. I only have one windows PC, and I think a virtual desktop is not going to work here because opengl will be handled differently there.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @VirtualFloat said in QtWebEngine stops displaying when undocked:

                      I think a virtual desktop is not going to work here because opengl will be handled differently there.

                      Just as a note:
                      Depends on your OpenGL requirements.
                      Vmware workstation allows openGl 3.3
                      and so far only thing that didnt work for me was subsampling.

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        VirtualFloat
                        wrote on last edited by VirtualFloat
                        #11

                        Thanks for the help. I did the following:

                        • Created a virtual environement using python -m venv test
                        • activated it
                        • installed pyside2 using pip install pyside2

                        problem persists unchanged, but now I'm also receiving the following error message in the console:

                        qt.qpa.backingstore: composeAndFlush: makeCurrent() failed.

                        This error is given about 4 times on each un-dock action (so when it stops working).
                        When docking (when the browser starts working again) the error is not given.

                        pip list
                        Package Version


                        pip 19.0.3
                        PySide2 5.14.2
                        setuptools 40.8.0
                        shiboken2 5.14.2

                        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