The UiLoader JavaScript global object allows the user to load pre-defined Qt forms that define Qt widgets (generally built within Qt Designer).
This allows users to build complex dialogs, using all of the pre-defined widgets that Qt4.8 supports. See Qt documentation for further details: http://qt-project.org/doc/qt-4.8.
This is an example of how to build a dialog using a predefined Qt designer file ( *.ui ) All widgets may be addressed directly, but through nested names. That is, if you have a checkbox inside a tab inside a dialog, you should address the widget as dialog.tab.checkbox Once you've figured out its name, you are allowed to modify all of its properties, plus you have access to both its signals and slots ( as well as its inherited properties, signals and slots )
This example and the predefined form are part of the installation, so it can be run in the software to see what it does. Look for lightTableExampleUsingPredefinedUI. It will display a non-modal widget that allows the adjustment of the light table settings in the camera view. Please refer to Qt documentation for the list of accessible widget properties.
function lightTableExampleUsingPredefineUI()
{
this.opacityChanged = function( digitValue)
{
this.ui.LightTableOpacityValueLabel.text = digitValue / 256.0;
}
this.washChanged = function( digitValue)
{
this.ui.LightTableWashValueLabel.text = digitValue / 256.0;
}
localPath += "/forms/lighttable.ui";
this.ui = UiLoader.load( localPath );
ui.show();
this.ui.windowTitle = "Light Table Values";
this.ui.LightTableWashLabel.text ="LightTable Wash";
this.ui.LightTableOpacityLabel.text ="LightTable Opacity";
this.ui.LightTableWashSlider.minimun = 0;
this.ui.LightTableWashSlider.maximum = 256;
this.ui.LightTableOpacitySlider.minimun = 0;
this.ui.LightTableOpacitySlider.maximum = 256;
this.ui.LightTableOpacitySlider.value =
preferences.
getDouble(
"DRAWING_LIGHTTABLE_OPACITY",0 ) * 256;
ui.LightTableOpacitySlider.valueChanged.connect( this, this.opacityChanged);
ui.LightTableWashSlider.valueChanged.connect( this, this.washChanged);
}