![]() |
VR-Forces 4.1 Class Documentation
|
The DtUiElement class is the base for which all UI elements are defined. More...
Public Types | |
| enum | DtUiElementEventTypes { DtUiElementTypeUnknown = 0, DtUiElementItemExpand = 1, DtUiElementItemCollapse = 2, DtUiElementHierarchySelectionChanged = 3, DtUiElementSaveStateChanged = 4, DtUiElementAddedToHierarchy = 5, DtUiElementRemovedFromHierarchy = 6, DtUiElementMovedInHierarchy = 7, DtUiElementReplacedInHierarchy = 8, DtUiElementForceChanged = 9, DtUiElementConfigureDiGuyOn = 10, DtUiElementConfigureDiGuyOff = 11, DtUiElementPositionModified = 12, DtUiElementPositionDestroyed = 13, DtUiBoundingVolumeModified = 14, DtUiCanvasInitialized = 15, DtUiDiGuyDataChanged = 16, DtUiRequestDiGuyData = 17, DtUiDiGuyDataResponse = 18, DtUiCreateController = 19, DtUiCleanup = 20, DtUiElementHierarchyChanged = 21 } |
Public Member Functions | |
| DtUiElementEvent (DtUiElement *owner=0, DtUiElementEventTypes type=DtUiElementTypeUnknown) | |
| DtUiElementEvent (const DtUiElementEvent &orig) | |
| DtUiElementEvent & | operator= (const DtUiElementEvent &rhs) |
| DtUiElement * | owner () const |
| DtUiElementEventTypes | type () const |
| void | setType (DtUiElementEventTypes t) |
| void | setValue (const QVariant &val) |
| const QVariant & | value () const |
Protected Attributes | |
| DtUiElement * | myOwner |
| QVariant | myValue |
| DtUiElementEventTypes | myType |
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()->registerType<MyNewUiElement>("my-ui-element");
2) Your new UI element will have to create some content. Override the createDataEntryElement() method for this:
QWidget* DtUiStringElement::createDataEntryElement(QWidget* parent) { myLineEdit = new QLineEdit(parent); myLineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QObject::connect(myLineEdit, SIGNAL(textChanged(const QString&)), &mySignalHandler, SLOT(elementChanged()));
return myLineEdit; }
3) 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); }
4) 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(); }
5) Implement a clone and copy constructor method to be able to duplicate your ui element This class is used for signalling events up/down the chain
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Referenced by operator=().
|
protected |
Referenced by operator=().
|
protected |
Referenced by operator=().