Script DzUiLoader and QSlider to DzSlider

Vholf3DVholf3D Posts: 63

Hello,

I'm trying to use the QtDesginer and load it with DzUiLoader to produce a quick UI for a personal script, and everything seems to work fine except the QSlider, it doesn't display as expected, as you can see bellow.

I understand why, DzSlider does not inherit form QSlider, it implements a brand new QWidget. So I was hoping I could create a new DzFloatSlider and add it to the dialog, inside the specified layout, doing the following:

var dialog = new DzDialog();
var widget = dzUiLoader.load(fileName, dialog);
var slider = new DzFloatSlider(dialog);
var layout = widget.findChildOfWidget("horizontalLayout_1");
layout.addWidget(slider); // Error, addWidget is not a function of QLayout

 

I get an error while trying to add the widget to the layout I want, I guess QLayout methods are not exposed through scripting, so the slider is added to the dialog, but it shows up in position 0 and is not added to any layout

Also, DzUiLoader::createWidget() is unable to create DzWidgets, it only creates QWidgets, so no luck there either.

So my question is, is it possible to load a dialog from a QtDesigner .ui file, and add widgets to it inside specific layouts? My dialog works perfectly if not for the DzSlider, I would hate having to manually build the entire dialog just because that one widget does not work :( . The one above is just for showcasing the issue, my dialog has tabs, several different layouts and plenty of controls.

Any help is appreciated.

Update: Fixed post images

Post edited by Vholf3D on
Sign In or Register to comment.