Closed prjemian closed 1 year ago
The PyDM package has a factory method to assist in doing the same with the PyDM custom widgets.
references:
Custom Python Qt5 widgets in Qt Designer
Instructions for QVideoWidget:
- Add regular
QWidget
to the form.- Select
Promote to
from the added widget context menu.- In the dialog put
QVideoWidget
as Promoted class name, Header file should automatically becomeqvideowidget.h
.- Click
Add
, and thenPromote
. Now you have QVideoWidget on your form.
Tried this in date_time_range_slider.ui
, for RangeSlider
. After clicking the Add button, the Promote became enabled. This actually worked!
The range_slider.h
file is fictitious. Not sure why it did not raise a FileNotFound
exception.
Similarly, promote when the DateTimeRangeSlider
(a QWidget
, actually) is used. Exact file name will change with the MVC refactor PR #128.
Widget promotion is the correct choice in this case, since these widgets are used only in our own code. The methods used by the PyDM package apply to widgets from the package that will be used by other code, not the case here.
Will wait for #128 before starting this work.
It would be nice if ...
... the custom widgets defined here (such as
DateTimeRangeSlider
orRangeSlider
) by Python code could be used in other widgets in the Qt Designer.