VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
makVrv::DtItemsListWidget Class Reference

Widget for display the objects, terrains, observers in the scene in a list. Used by DtObjectsListWidget, DtTerrainListWidget, DtObserversListWidget.

See Also
makVrv::DtItemsListInterface
Inheritance diagram for makVrv::DtItemsListWidget:
Inheritance graph
[legend]

Public Types

enum  ItemsListWidgetItemDataRole { ItemElementId = Qt::UserRole, ItemDisplayName, ItemType, ItemIsSubType }
 

Public Member Functions

virtual ~DtItemsListWidget ()
 
void setupGui ()
 
void connectSignals ()
 
virtual void addSubTypeTopLevelItem (const DtElementAttributes::ElementSubtypes &subType, const std::string &displayName, int index, const std::string &icon)
 
virtual void addSubTypeTopLevelItem (const DtElementAttributes::ElementSubtypes &subType, const std::string &displayName, int index, double r, double g, double b)
 
virtual void addSubTypeItem (const DtElementAttributes::ElementSubtypes &subType, DtElementID elementId, const std::string &displayName)
 
virtual bool hasSubTypeTopLevelItem (const DtElementAttributes::ElementSubtypes &subType)
 
virtual void addTypeTopLevelItem (const DtElementEntry::ElementType &type, const std::string &displayName, int index, const std::string &icon)
 
virtual void addTypeItem (const DtElementEntry::ElementType &type, DtElementID elementId, const std::string &displayName)
 
virtual bool hasTypeTopLevelItem (const DtElementEntry::ElementType &type)
 
virtual void sortItems ()
 
virtual void removeItem (DtElementID id)
 
virtual void renameItem (DtElementID id, const std::string &newName)
 
virtual void updateItemIcon (DtElementID id)
 
virtual void updateItemSubType (DtElementID id, int subType)
 
virtual void setSelectedItems (const DtSelectionManager::IdSet &selected, const DtSelectionManager::IdSet &deselected)
 
virtual bool comparator (const QTreeWidgetItem &lhs, const QTreeWidgetItem &rhs) const
 
virtual void updateElementsParent (DtElementID elementId, DtElementID parentId) override
 
virtual void updateElementDisplayState (DtElementID elementId, int displayState) override
 

Protected Slots

virtual void on_objectsTreeWidget_rightClickOnItem (QTreeWidgetItem *item, QMouseEvent *, int column)
 
virtual void on_objectsTreeWidget_itemDoubleClicked (QTreeWidgetItem *item, int column)
 
virtual void on_objectsTreeWidget_itemSelectionChanged ()
 
virtual void on_lookupLineEdit_textChanged (QString str)
 
virtual void on_searchCleanButton_released ()
 

Protected Member Functions

 DtItemsListWidget (DtDe &de, QWidget *parent=NULL, const Qt::WindowFlags &f=0)
 
void setItemAttributes (QTreeWidgetItem *item, DtElementID elementId, const QString &displayName)
 
DtElementID getItemElementId (QTreeWidgetItem *item)
 
bool parseNumber (const QTreeWidgetItem &lhs, int &number, QString &name) const
 
virtual void refreshAllIcons () override
 

Protected Attributes

DtDe & myDe
 
QVBoxLayout * myMainLayout
 
QLabel * myLookupLabel
 
QLineEdit * myLookupLineEdit
 
QPushButton * mySearchCleanButton
 
DtTreeWidget * myObjectsTreeWidget
 
std::unordered_map
< DtElementEntry::ElementType,
QTreeWidgetItem * > 
myElementTypeItemsMap
 
std::unordered_map
< DtElementAttributes::ElementSubtypes,
QTreeWidgetItem * > 
myElementSubtypeItemsMap
 
std::unordered_map
< DtElementID, QTreeWidgetItem * > 
myElementItemsMap
 
std::map< const QString,
std::pair< QString, int > > 
myObjectListCache
 

Private Member Functions

 DtItemsListWidget ()=delete
 
 DtItemsListWidget (const DtItemsListWidget &orig)=delete
 
DtItemsListWidget & operator= (const DtItemsListWidget &orig)=delete
 

Friends

class DtItemsListWidgetCreator
 

Additional Inherited Members

- Public Attributes inherited from makVrv::DtItemsListInterface
boost::signalslib::signal
< void(DtElementID)> 
signal_itemAttachRequested
 
boost::signalslib::signal
< void(std::vector
< DtElementID >)> 
signal_itemSelectionChanged
 

Member Enumeration Documentation

Item data stored in the objects tree widget item.

Enumerator
ItemElementId 
ItemDisplayName 
ItemType 
ItemIsSubType 

Constructor & Destructor Documentation

virtual makVrv::DtItemsListWidget::~DtItemsListWidget ( )
virtual

DTOR.

makVrv::DtItemsListWidget::DtItemsListWidget ( DtDe &  de,
QWidget *  parent = NULL,
const Qt::WindowFlags &  f = 0 
)
protected

CTOR. Use DtOsgEarthProfileDialogCreator to create an instance of this class.

makVrv::DtItemsListWidget::DtItemsListWidget ( )
privatedelete

Unimplemented Default CTOR.

makVrv::DtItemsListWidget::DtItemsListWidget ( const DtItemsListWidget &  orig)
privatedelete

Not implemented.

Member Function Documentation

void makVrv::DtItemsListWidget::setupGui ( )

Create the widgets and layout. Called in the CTOR.

void makVrv::DtItemsListWidget::connectSignals ( )

Connect the signals.

virtual void makVrv::DtItemsListWidget::addSubTypeTopLevelItem ( const DtElementAttributes::ElementSubtypes &  subType,
const std::string &  displayName,
int  index,
const std::string &  icon 
)
virtual

Add a top level item which has subtype items as children(Friendly, Opposing, Munitions, etc).

Parameters
subTypeThe subtype of the child items.
displayNameThe display name of the top level item.
indexThe index of the top level item in the tree.
iconThe icon of the item, empty string means no icon.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::addSubTypeTopLevelItem ( const DtElementAttributes::ElementSubtypes &  subType,
const std::string &  displayName,
int  index,
double  r,
double  g,
double  b 
)
virtual

Add a top level item which has subtype items as children(Friendly, Opposing, Munitions, etc).

Parameters
subTypeThe subtype of the child items.
displayNameThe display name of the top level item.
indexThe index of the top level item in the tree.
rThe red color of the icon if the icon is generated by the color.
gThe red color of the icon if the icon is generated by the color.
bThe red color of the icon if the icon is generated by the color.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::addSubTypeItem ( const DtElementAttributes::ElementSubtypes &  subType,
DtElementID  elementId,
const std::string &  displayName 
)
virtual

Add a subtype item(Friendly, Opposing, Munitions, etc).

Parameters
subTypeThe subtype of the item
elementIdThe elementId of the item.
displayNameThe display name of the item.
iconThe icon of the item, empty string means no icon.

Implements makVrv::DtItemsListInterface.

Reimplemented in makVrv::DtObjectsListWidget.

virtual bool makVrv::DtItemsListWidget::hasSubTypeTopLevelItem ( const DtElementAttributes::ElementSubtypes &  subType)
virtual

Check if the tree has a subtype top level item with the given subType.

Parameters
subTypeThe subtype of the item

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::addTypeTopLevelItem ( const DtElementEntry::ElementType &  type,
const std::string &  displayName,
int  index,
const std::string &  icon 
)
virtual

Add a top level item which has type items as children(Observers, Tactical Graphics, etc).

Parameters
typeThe type of the child items.
displayNameThe display name of the top level item.
indexThe index of the top level item in the tree.
iconThe icon of the item, empty string means no icon.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::addTypeItem ( const DtElementEntry::ElementType &  type,
DtElementID  elementId,
const std::string &  displayName 
)
virtual

Add a tye item(Observers, Tactical Graphics, etc).

Parameters
typeThe type of the item
elementIdThe elementId of the item.
displayNameThe display name of the item.
iconThe icon of the item, empty string means no icon.

Implements makVrv::DtItemsListInterface.

virtual bool makVrv::DtItemsListWidget::hasTypeTopLevelItem ( const DtElementEntry::ElementType &  type)
virtual

Check if the tree has a type top level item with the given type.

Parameters
typeThe type of the item

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::sortItems ( )
virtual

Sort all the tree widget items under subType top level item and type top level item.

Implements makVrv::DtItemsListInterface.

Reimplemented in makVrv::DtObjectsListWidget, makVrv::DtTerrainListWidget, and makVrv::DtObserversListWidget.

virtual void makVrv::DtItemsListWidget::removeItem ( DtElementID  id)
virtual

Remove an item with the given element Id from the tree.

Implements makVrv::DtItemsListInterface.

Reimplemented in makVrv::DtObjectsListWidget.

virtual void makVrv::DtItemsListWidget::renameItem ( DtElementID  id,
const std::string &  newName 
)
virtual

Rename an item with the new name.

Parameters
idThe element ID of the item to rename.
newNameThe new name of the item.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::updateItemIcon ( DtElementID  id)
virtual

Update the icon of the item.

Parameters
idThe element ID of the item.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::updateItemSubType ( DtElementID  id,
int  subType 
)
virtual

Update the subType of the item, change of force type etc.

Parameters
idThe element ID of the item to update.
subTypeDtElementAttributes::ElementSubtypes enum.

Implements makVrv::DtItemsListInterface.

Reimplemented in makVrv::DtObjectsListWidget.

virtual void makVrv::DtItemsListWidget::setSelectedItems ( const DtSelectionManager::IdSet &  selected,
const DtSelectionManager::IdSet &  deselected 
)
virtual

Update the current selection of the tree widget.

Implements makVrv::DtItemsListInterface.

virtual bool makVrv::DtItemsListWidget::comparator ( const QTreeWidgetItem &  lhs,
const QTreeWidgetItem &  rhs 
) const
virtual

compare the names of two list items for sorting This method is used for sorting the objects in a item list. It works like a standard 'operator<' - true if lhs is < rhs, false otherwise. This default comparator looks for names of the form '<someString> <someNumber>', which is what most VR-Forces marking texts look like (e.g., Civ 1, Civ 2). If the names compared are both of that form and both have the same base string, then they are compared based on the number (so Civ 2 < Civ 10); otherwise they are compared lexicographically.

virtual void makVrv::DtItemsListWidget::updateElementsParent ( DtElementID  elementId,
DtElementID  parentId 
)
overridevirtual

Update the parent element of elementId.

Implements makVrv::DtItemsListInterface.

Reimplemented in makVrv::DtObjectsListWidget.

virtual void makVrv::DtItemsListWidget::updateElementDisplayState ( DtElementID  elementId,
int  displayState 
)
overridevirtual

Update the display state of elementId display state is DtElementIDHierarchyDisplayState::DisplayState.

Implements makVrv::DtItemsListInterface.

Reimplemented in makVrv::DtObjectsListWidget.

void makVrv::DtItemsListWidget::setItemAttributes ( QTreeWidgetItem *  item,
DtElementID  elementId,
const QString &  displayName 
)
protected

Set the attributes of the item.

Parameters
itemThe QTreeWidgetItem.
elementIdThe elementId of the item.
displayNameThe display name of the item.
DtElementID makVrv::DtItemsListWidget::getItemElementId ( QTreeWidgetItem *  item)
protected

Convenient function to get the element id of the item.

Parameters
itemThe QTreeWidgetItem.
Returns
The element id of the item.
bool makVrv::DtItemsListWidget::parseNumber ( const QTreeWidgetItem &  lhs,
int &  number,
QString &  name 
) const
protected

This helper function is used by the comparator to determine is a name is of the type described in.

See Also
comparator() and if so, returns the name and number portions of the string
virtual void makVrv::DtItemsListWidget::refreshAllIcons ( )
overrideprotectedvirtual

Re-apply icons to all tree items after the MIL symbol standard has changed.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::on_objectsTreeWidget_rightClickOnItem ( QTreeWidgetItem *  item,
QMouseEvent *  ,
int  column 
)
protectedvirtualslot

Slot when user right click on the tree widget item.

virtual void makVrv::DtItemsListWidget::on_objectsTreeWidget_itemDoubleClicked ( QTreeWidgetItem *  item,
int  column 
)
protectedvirtualslot

Slot when user double click on the tree widget item.

virtual void makVrv::DtItemsListWidget::on_objectsTreeWidget_itemSelectionChanged ( )
protectedvirtualslot

Slot when the current selection of the tree widget changed.

virtual void makVrv::DtItemsListWidget::on_lookupLineEdit_textChanged ( QString  str)
protectedvirtualslot

Slot the text of the line edit changed.

virtual void makVrv::DtItemsListWidget::on_searchCleanButton_released ( )
protectedvirtualslot

Slot when user click on the clean filter button.

DtItemsListWidget& makVrv::DtItemsListWidget::operator= ( const DtItemsListWidget &  orig)
privatedelete

Not implemented.

Friends And Related Function Documentation

friend class DtItemsListWidgetCreator
friend

Member Data Documentation

DtDe& makVrv::DtItemsListWidget::myDe
protected
QVBoxLayout* makVrv::DtItemsListWidget::myMainLayout
protected
QLabel* makVrv::DtItemsListWidget::myLookupLabel
protected
QLineEdit* makVrv::DtItemsListWidget::myLookupLineEdit
protected
QPushButton* makVrv::DtItemsListWidget::mySearchCleanButton
protected
DtTreeWidget* makVrv::DtItemsListWidget::myObjectsTreeWidget
protected
std::unordered_map<DtElementEntry::ElementType, QTreeWidgetItem*> makVrv::DtItemsListWidget::myElementTypeItemsMap
protected
std::unordered_map<DtElementAttributes::ElementSubtypes, QTreeWidgetItem*> makVrv::DtItemsListWidget::myElementSubtypeItemsMap
protected
std::unordered_map<DtElementID, QTreeWidgetItem*> makVrv::DtItemsListWidget::myElementItemsMap
protected
std::map<const QString, std::pair<QString, int> > makVrv::DtItemsListWidget::myObjectListCache
mutableprotected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)