VR-Forces 4.10 Class Documentation
 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. More...

Inheritance diagram for makVrv::DtItemsListWidget:
Inheritance graph
[legend]

Public Types

enum  ItemsListWidgetItemDataRole { ItemElementId = Qt::UserRole, ItemDisplayName, ItemType, ItemIsSubType }
 Item data stored in the objects tree widget item. More...
 

Public Member Functions

virtual ~DtItemsListWidget ()
 DTOR. More...
 
void setupGui ()
 Create the widgets and layout. Called in the CTOR. More...
 
void connectSignals ()
 Connect the signals. More...
 
virtual void addSubTypeTopLevelItem (const DtElementAttributes::ElementSubtypes &subType, const std::string &displayName, int index, const std::string &icon)
 Add a top level item which has subtype items as children(Friendly, Opposing, Munitions, etc). More...
 
virtual void addSubTypeTopLevelItem (const DtElementAttributes::ElementSubtypes &subType, const std::string &displayName, int index, double r, double g, double b)
 Add a top level item which has subtype items as children(Friendly, Opposing, Munitions, etc). More...
 
virtual void addSubTypeItem (const DtElementAttributes::ElementSubtypes &subType, DtElementID elementId, const std::string &displayName)
 Add a subtype item(Friendly, Opposing, Munitions, etc). More...
 
virtual bool hasSubTypeTopLevelItem (const DtElementAttributes::ElementSubtypes &subType)
 Check if the tree has a subtype top level item with the given subType. More...
 
virtual void addTypeTopLevelItem (const DtElementEntry::ElementType &type, const std::string &displayName, int index, const std::string &icon)
 Add a top level item which has type items as children(Observers, Tactical Graphics, etc). More...
 
virtual void addTypeItem (const DtElementEntry::ElementType &type, DtElementID elementId, const std::string &displayName)
 Add a tye item(Observers, Tactical Graphics, etc). More...
 
virtual bool hasTypeTopLevelItem (const DtElementEntry::ElementType &type)
 Check if the tree has a type top level item with the given type. More...
 
virtual void sortItems ()
 Sort all the tree widget items under subType top level item and type top level item. More...
 
virtual void removeItem (DtElementID id)
 Remove an item with the given element Id from the tree. More...
 
virtual void renameItem (DtElementID id, const std::string &newName)
 Rename an item with the new name. More...
 
virtual void updateItemDamageState (DtElementID id, DtEntityStateListener::DamageState damageState)
 Update the damage state of the item, update the icon mostly. More...
 
virtual void updateItemSubType (DtElementID id, int subType)
 Update the subType of the item, change of force type etc. More...
 
virtual void setSelectedItems (const DtSelectionManager::IdSet &selected, const DtSelectionManager::IdSet &deselected)
 Update the current selection of the tree widget. More...
 
virtual bool comparator (const QTreeWidgetItem &lhs, const QTreeWidgetItem &rhs) const
 compare the names of two list items for sorting This method is used for sorting the objects in a item list. More...
 

Protected Slots

virtual void on_objectsTreeWidget_rightClickOnItem (QTreeWidgetItem *item, QMouseEvent *, int column)
 Slot when user right click on the tree widget item. More...
 
virtual void on_objectsTreeWidget_itemDoubleClicked (QTreeWidgetItem *item, int column)
 Slot when user double click on the tree widget item. More...
 
virtual void on_objectsTreeWidget_itemSelectionChanged ()
 Slot when the current selection of the tree widget changed. More...
 
virtual void on_lookupLineEdit_textChanged (QString str)
 Slot the text of the line edit changed. More...
 
virtual void on_searchCleanButton_released ()
 Slot when user click on the clean filter button. More...
 

Protected Member Functions

 DtItemsListWidget (DtDe &de, QWidget *parent=NULL, const Qt::WindowFlags &f=0)
 CTOR. Use DtOsgEarthProfileDialogCreator to create an instance of this class. More...
 
void setItemAttributes (QTreeWidgetItem *item, DtElementID elementId, const QString &displayName)
 Set the attributes of the item. More...
 
DtElementID getItemElementId (QTreeWidgetItem *item)
 Convenient function to get the element id of the item. More...
 
bool parseNumber (const QTreeWidgetItem &lhs, int &number, QString &name) const
 This helper function is used by the comparator to determine is a name is of the type described in. More...
 

Protected Attributes

DtDemyDe
 
QVBoxLayout * myMainLayout
 
QLabelmyLookupLabel
 
QLineEditmyLookupLineEdit
 
QPushButtonmySearchCleanButton
 
DtTreeWidgetmyObjectsTreeWidget
 
boost::unordered_map
< DtElementEntry::ElementType,
QTreeWidgetItem * > 
myElementTypeItemsMap
 
boost::unordered_map
< DtElementAttributes::ElementSubtypes,
QTreeWidgetItem * > 
myElementSubtypeItemsMap
 
boost::unordered_map
< DtElementID, QTreeWidgetItem * > 
myElementItemsMap
 
std::map< const QString,
std::pair< QString, int > > 
myObjectListCache
 

Private Member Functions

 DtItemsListWidget ()=delete
 Unimplemented Default CTOR. More...
 
 DtItemsListWidget (const DtItemsListWidget &orig)=delete
 Not implemented. More...
 
DtItemsListWidgetoperator= (const DtItemsListWidget &orig)=delete
 Not implemented. More...
 

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
 

Detailed Description

Widget for display the objects, terrains, observers in the scene in a list.

Used by DtObjectsListWidget, DtTerrainListWidget, DtObserversListWidget.

See Also
makVrv::DtItemsListInterface

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.
rThe red color of the icon[0,1].
gThe green color of the icon[0,1].
bThe blue color of the icon[0,1].

Implements makVrv::DtItemsListInterface.

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.
rThe red color of the icon[0,1].
gThe green color of the icon[0,1].
bThe blue color of the icon[0,1].

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::DtTerrainListWidget, makVrv::DtObjectsListWidget, 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.

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

Rename an item with the new name.

Parameters
newNameThe new name of the item.

Implements makVrv::DtItemsListInterface.

virtual void makVrv::DtItemsListWidget::updateItemDamageState ( DtElementID  id,
DtEntityStateListener::DamageState  damageState 
)
virtual

Update the damage state of the item, update the icon mostly.

Parameters
damageStateDtDamageState enum.

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
subTypeDtElementAttributes::ElementSubtypes enum.

Implements makVrv::DtItemsListInterface.

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.

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. 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::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
boost::unordered_map<DtElementEntry::ElementType, QTreeWidgetItem*> makVrv::DtItemsListWidget::myElementTypeItemsMap
protected
boost::unordered_map<DtElementAttributes::ElementSubtypes, QTreeWidgetItem*> makVrv::DtItemsListWidget::myElementSubtypeItemsMap
protected
boost::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 Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)