Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved QFormBuilder was unable to create a custom widget of the class 'QVideoWidget'

    Qt for Python
    pyside2 qt for python
    3
    11
    1436
    Loading More Posts
    • 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.
    • P
      publicname40828 last edited by publicname40828

      after successfully porting every other part of my app from pyqt5 to pyside2, everything is functioning properly except the qvideowidget. it's promoted on the qt creator form exactly the same as the way it was in pyqt5, but with the correct(?) pyside2 header file, at least according to what i found in the docs?

      alt text

      error message:
      "QFormBuilder was unable to create a custom widget of the class 'QVideoWidget'; defaulting to base class 'QWidget'."

      this is in ubuntu linux. i can hear the video's audio playing, but i the video won't visually display because of the widget being unable to promote to qvideowidget. i've been all over the pyside2 documentation looking for the solution but i can't recognize what i'm doing wrong, or if it's something to do with my qt creator installation

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        Can you import and create a QVideoWidget if you do it only with code ?

        By the way, which version of PySide2 are you using ?

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

        P 1 Reply Last reply Reply Quote 1
        • P
          publicname40828 @SGaist last edited by publicname40828

          @SGaist , thank you for your reply, my lack of understanding of this issue has put my project on a screeching halt

          creating through code:

          testVideoWidget = QVideoWidget
          print(testVideoWidget)
          

          results in:
          <class 'PySide2.QtMultimediaWidgets.QVideoWidget'>

          it seems to work when written in python, but promotion still doesn't

          checking version in pip:

          Requirement already satisfied: pyside2 in /usr/local/lib/python3.8/dist-packages (5.15.2)
          Requirement already satisfied: shiboken2==5.15.2 in /usr/local/lib/python3.8/dist-packages (from pyside2) (5.15.2)
          

          so, looks like v5.15.2 for pyside2

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Then I think you may have found a bug.

            You should check the bug report system to see if there's something related already. If not please open a new report providing a minimal project that shows the issue.

            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 Reply Quote 1
            • P
              publicname40828 last edited by

              i wasn't able to find a similar bug, so i posted as suggested:
              https://bugreports.qt.io/browse/QTCREATORBUG-25271

              thank you for pointing me in the right direction

              1 Reply Last reply Reply Quote 0
              • P
                publicname40828 last edited by publicname40828

                The bug report was closed with the following message:
                "We don't ship a custom widget for QVideoWidget, so this is to be expected."

                is there anything I can do from here?
                is there some way to create it in code and embed it into the form in a specific location?

                without a FOSS QVideoWidget I have to move the entire project to another platform, it completely invalidates my using pyside2 for the project as i want to provide this in a FOSS way the pyqt5 license won't allow, and i'm also not willing to buy a license to provide something free

                JonB 1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  You should provide a minimal project on the bug report that reproduces that behaviour.

                  And explain the steps to reproduce it.

                  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 Reply Quote 0
                  • P
                    publicname40828 last edited by

                    i was unable to provide a project example for the following 2 reasons:

                    1 - loading any form.ui containing the promoted widget causes the bug, so creating a new pyside2 project in qt-creator is the only requirement

                    2- widget promotion ui only allows one widget for each name, so comparing between pyqt5 / pyside2 versions of QVideoWidget seems impossible without some workaround, which lead me to enclose the image snip


                    however, in the mean time i've figured out how to neatly embed QVideoWidget declared in python within an existing UI outside of qt creator

                    1 Reply Last reply Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      Lets take a step back, I may have misunderstood what is going on:

                      • What step did you use to create the original file that works with PyQt5 but not PySide2 ?
                      • Is it only a bug in Qt Creator or does it also fail at run time ?

                      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 Reply Quote 1
                      • JonB
                        JonB @publicname40828 last edited by

                        @publicname40828 said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget':

                        is there some way to create it in code and embed it into the form in a specific location?

                        Please answer @SGaist's questions first. But taking a further step back, in answer to this question you do not have to be able to put a widget on a Designer form or make it work with Promote to use it. Before you say you might abandon the whole Qt approach, are you aware that you can indeed create desired widget type at runtime even if you cannot see it/do so at design-time?

                        1 Reply Last reply Reply Quote 0
                        • P
                          publicname40828 last edited by

                          thank you each for your responses


                          @SGaist said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget':

                          • What step did you use to create the original file that works with PyQt5 but not PySide2 ?
                          • Is it only a bug in Qt Creator or does it also fail at run time ?
                          1. making a new project in qt-creator using python auto-generates the code for PyQt5, then i switched the imports to PySide2, and changed the uic method of loading UI for the QUiLoader method. everything else remains completely untouched, and 100% of everything else seems to be perfectly functional without producing any error
                          2. the application will continue to run and function perfectly normal, but the widget won't appear. it's more of an 'ignore' than a 'fail'. from the bug report responses it seems maybe there just -isn't- a QVideoWidget for PySide2?

                          @JonB said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget':

                          you do not have to be able to put a widget on a Designer form or make it work with Promote to use it. Before you say you might abandon the whole Qt approach, are you aware that you can indeed create desired widget type at runtime even if you cannot see it/do so at design-time?

                          i am aware, it's what i spoke of in this quote, though the way i worded it could have been more clear and could lead to confusion.

                          @publicname40828 said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget':

                          however, in the mean time i've figured out how to neatly embed QVideoWidget declared in python within an existing UI outside of qt creator

                          i declared the QVideoWidget in python providing the ui as a parent (in arg), then used setGeometry to make it fit the exact location of the widget that was made in the form.ui. this is the only Widget that isn't working for me in the transition from PyQt5 to PySide2 so migrating the project will no longer be necessary, and being able to get the exact geometry in a glance in qt-creator made it a relatively quick fix

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post