The DtUiElement class is the base for which all UI elements are defined.
If you wish to create a new UI element, you must subclass this item and:
1) Register is i the uiElement factory: DtUiElement()::elementFactory()[<reader_writer_type>] = boost::bind(&MyElement::CreatorFunction);
2) Add code to take information from the descriptor and place it into your element void DtUiStringElement::setFromParameters(DtReaderWriter* parentRw) { DtReaderWriterRegistryData* val = value(parentRw);
if (val) { DtRwString* str = dynamic_cast<DtRwString*>(val->readerWriter());
if (str) { myLineEdit->blockSignals(true); myLineEdit->setText(QString::fromLocal8Bit(str->c_str())); myLineEdit->blockSignals(false); } }
DtUiElement::setFromParameters(parentRw); }
3) Create code to update the parameter descriptor element when your element changes void DtUiStringElement::elementChanged() { if (myValue) { DtRwString* str = dynamic_cast<DtRwString*>(myValue->readerWriter());
if (str) { str = (const char)myLineEdit->text().toLocal8Bit(); } }
DtUiElement::elementChanged(); }
In order to use the units class, you muse add dynamic properties in designer for the particular field. Add "display-units" and/or "source-units". Other keywords will be represented at specific uiElement levels
The object names in the designer .ui will match to the reader/writer names of the data elements, having the
- sign replaced with an _ (so, short-name becomes short_name in the .ui file). If you wish to also have a label associated with the item, define a label with the _label attached to the object name (so, short_name_label) This class is used for signaling events up/down the chain