User Tools

Site Tools


DzComboEdit

DAZScript wrapper for a compound QLineEdit, QPushButton and QMenu widget.

More...

Inherits :

Properties

Constructors

DAZ Script
DzComboEdit ( DzWidget parent, Boolean updateOnSelect=true )

Methods

DAZ Script
voidaddItem ( String item )
voidaddItems ( Array items )
voidclear ()
NumberfindItem ( String text )
voidinsertItem ( Number index, String item )
voidinsertItems ( Number index, Array items )
Arrayitems ()
voidremoveItem ( String item )

Signals

voiditemChanged ( String item )
voidtextChanged ( String text )

Detailed Description

A DzComboEdit provides a compound widget comprised of a line edit and a button that, when clicked, causes a menu to be displayed. Selecting one of the items in the popup menu causes the value of the editor to update with the text of the selected item by default. A separator can be created in a menu by using a single hyphen (“-”) character. Sub-menus can be created by using two consecutive greater than (“»”) characters as a delimiter between the entries of a given hierarchy.

Example:

var oNode = Scene.getPrimarySelection();
if( oNode ){
	if( oNode.inherits( "DzBone" ) ){
		oNode = oNode.getSkeleton();
	}
 
	var aNodes = oNode.getAllBones();
	aNodes.unshift( oNode );
 
	var oDlg = new DzBasicDialog();
	var sHelpTitle = qsTr("Select a Node");
	var sHelpBody = qsTr("This is a basic dialog for requesting user input.");
	oDlg.caption = sHelpTitle;
	oDlg.toolTip = sHelpBody;
	oDlg.whatsThis = String("<b>%1</b><br/><br/>%2").arg( sHelpTitle ).arg( sHelpBody );
 
	var sEmpty = qsTr("None");
 
	var oNodeCmbEdt = new DzComboEdit( oDlg );
	oNodeCmbEdt.text = sEmpty;
	oNodeCmbEdt.readOnly = true;
	oNodeCmbEdt.addItems( [sEmpty, "-"] );
	for( var i = 0; i < aNodes.length; i += 1 ){
			oNodeCmbEdt.addItem( aNodes[i].getLabel() );
	}
	sHelpTitle = qsTr("Node Selector");
	sHelpBody = qsTr("Click the arrow for options. Right click the field for additional options.");
	oNodeCmbEdt.toolTip = sHelpBody;
	oNodeCmbEdt.whatsThis = String("<b>%1</b><br/><br/>%2").arg( sHelpTitle ).arg( sHelpBody );
	oDlg.addWidget( oNodeCmbEdt );
 
	var oWidget = oDlg.getWidget();
	oWidget.objectName = "DzComboEditExampleDlg";
 
	var sizeHint = oWidget.minimumSizeHint;
	var nHeight = sizeHint.height;
 
	oDlg.setFixedHeight( nHeight );
 
	if( oDlg.exec() ){
		print( qsTr("Dialog accted.") );
		if( oNodeCmbEdt.text == sEmpty ){
			print( qsTr("None selected.") );
		} else {
			print( qsTr("Node selected:"), oNodeCmbEdt.text );
		}
	} else {
		print( qsTr("Dialog rejected.") );
	}
}

Properties


String : placeholderText

TODO: Add description.


Boolean : readOnly

TODO: Add description.


String : text

TODO: Add description.


Boolean : usePathPopUp

TODO: Add description.

Constructors


DzComboEdit( DzWidget parent, Boolean updateOnSelect=true )

Creates a combo edit as a child of the given parent widget.

Parameter(s):

  • parent - The widget parent for the combo edit.
  • updateOnSelect - Whether the editor should automatically update when an item is selected.

Methods


void : addItem( String item )

TODO: Add description.


void : addItems( Array items )

TODO: Add description.


void : clear()

TODO: Add description.


Number : findItem( String text )

TODO: Add description.


void : insertItem( Number index, String item )

TODO: Add description.


void : insertItems( Number index, Array items )

TODO: Add description.


Array : items()

TODO: Add description.


void : removeItem( String item )

TODO: Add description.

Signals


void : itemChanged( String item )

TODO: Add description.


void : textChanged( String text )

TODO: Add description.