QFormBuilder was unable to create a custom widget of the class 'QVideoWidget'
-
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?
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
-
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 ?
-
@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
-
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.
-
i wasn't able to find a similar bug, so i posted as suggested:
https://bugreports.qt.io/browse/QTCREATORBUG-25271thank you for pointing me in the right direction
-
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
-
You should provide a minimal project on the bug report that reproduces that behaviour.
And explain the steps to reproduce it.
-
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
-
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 ?
-
@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?
-
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 ?
- 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
- 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