DAZ and QT( from UI file) widgets - how to combine work?
YudinEd
Posts: 90
QT widgets work well with signals. But how to work together with DAZ widgets and widgets from UI file? For example, to put the DAZ button into QT Group box or in tab widget (and so on).
var loader = new DzUiLoader();var dialog = new DzDialog();var dialogWgt = loader.load("C:/untitled.ui",dialog);var groupBox=dialog.findChildOfWidget("groupBox"); // QT widget from UI filevar But=new DzPushButton(groupBox) // DAZ widget into QT widget from UIdialog.exec();
This code gives an error "general\dzscript.cpp(658): Unhandled error while executing script."
What I need to do to link different widgets - DAZ and QT?
Post edited by YudinEd on
Comments
Just use dialogWgt with findChildOfWidget() or even better getChildrenOfWidget.
My script example has "findChildOfWidget()". :) The problem was precisely in the presence of this function.
OK, I'll try "getChildrenOfWidget"
In the code you posted you wrote
dialog.findChildOfWidget("groupBox");
should be:
dialogWgt.findChildOfWidget("groupBox");
Reason is you are searching for a child of the just loaded UI widget, which is dialogWgt, not dialog.
I understood it. This is logical, but wrong. :) This option gives an error "general\dzscript.cpp(658): Unhandled error while executing script."
dialog.findChildOfWidget - it's true. But it works strange. Not all functions work.
To example - hide(), show(true) or .text="..." -function normally with QT widgets.
But .x or .y don't work
I can not put DAZ objects into a QT tab or in QT group too.
I have not tried using DAZ objects when working with UI files, I design the dialog the way I need it and then connect the event handlers. The objects in UI file are pure QT widgets, so they might have different properties than DzWidgets, for ex: to move a DzButton you just need to set x and y properties, but for QWidgets you need to extract the geometry(QRect) property and then set x and y properties.
That's how I did the Sun-Sky Time for Iray script. Although the UI file is decrypted before loading.
I did the script style with the UI designer.
But in the process of working on the script I had to make a list of figures and props from the scene using cycle for... to create group of checkboxes and objects names.
DAZ widgets and script code below were convenient for this case (I found the script basis here perhaps by Richard Haseltine ). I do not know how to do this using only QT widgets..
But I do not want to give up the general design made in UI designer.
I can not solve another problem too.
When DAZ reads *. ui, it does not find the path to the pictures. It requires a full path to the images in *.ui.
What to do, because each user has his own path to pictures? Is it possible to change something in the script or into the UI file ?
Use relative paths like in "./".
There are alternatives some alternatives you can use, like:
HTH
jag11, thanks very much. I'll try it.
I tried to combine widgets (DAZ+QT) in this way. I could not invent another :)