OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ak::aTreeWidget Class Reference

#include "aTreeWidget.h"

Inheritance diagram for ak::aTreeWidget:
ak::aWidget ak::aObject

Public Slots

void slotTreeKeyPressed (QKeyEvent *_event)
 
void slotTreeKeyReleased (QKeyEvent *_event)
 
void slotTreeItemActivated (QTreeWidgetItem *_item, int _column)
 
void slotTreeItemChanged (QTreeWidgetItem *_item, int _column)
 
void slotTreeItemClicked (QTreeWidgetItem *_item, int _column)
 
void slotTreeItemCollapsed (QTreeWidgetItem *_item)
 
void slotTreeItemDoubleClicked (QTreeWidgetItem *_item, int _column)
 
void slotTreeItemExpanded (QTreeWidgetItem *_item)
 
void slotTreeSelectionChanged ()
 
void slotTreeMouseMove (QMouseEvent *)
 
void slotTreeLeave (QEvent *)
 
void slotCustomContextMenuRequested (const QPoint &_pos)
 
void slotFilterTextChanged (void)
 Will perform actions on the filter text changed event.
 
void slotFilterKeyPressed (QKeyEvent *_event)
 Will perform actions on the filter enter pressed event.
 

Signals

void keyPressed (QKeyEvent *)
 
void keyReleased (QKeyEvent *)
 
void cleared (void)
 
void focusLost (void)
 
void selectionChanged (void)
 
void itemActivated (QTreeWidgetItem *, int)
 
void itemChanged (QTreeWidgetItem *, int)
 
void itemClicked (QTreeWidgetItem *, int)
 
void itemCollapsed (QTreeWidgetItem *)
 
void itemDoubleClicked (QTreeWidgetItem *, int)
 
void itemFocused (QTreeWidgetItem *)
 
void itemExpanded (QTreeWidgetItem *)
 
void itemTextChanged (QTreeWidgetItem *, int)
 
void itemLocationChanged (QTreeWidgetItem *, int)
 
void itemsMoved (const QList< ID > &_itemIds, const QList< ID > &_oldParentIds, const QList< ID > &_newParentIds)
 
void customContextMenuRequested (const QPoint &_pos)
 

Public Member Functions

 aTreeWidget ()
 Default constructor.
 
virtual ~aTreeWidget ()
 Deconstructor.
 
virtual QWidget * widget (void) override
 Will return the widgets widget to display it.
 
ID add (ID _parentId=-1, const QString &_text="", textAlignment _textAlignment=alignLeft, QIcon _icon=QIcon())
 Will add a new item to the tree widget and return its ID.
 
ID add (const QString &_cmd, char _delimiter='|', textAlignment _textAlignment=alignLeft, const QIcon &_icon=QIcon())
 Will add new items to the tree according to the provided command The command consists of the root item and the childs. The command may look like this: root|child|child2 In this case the delimiter will be the '|' and the tree will get a root item with the text "root" (if doesnt exist before) The root gets a child item with the text "child" and the child gets a child with the text "child2", so the tree looks like this: ->root ->->child ->->->child2 The very last item will also get the alignment, colors and icon set. Will return the UID of the very last item.
 
void clear (bool _emitEvent=true)
 Will clear all tree items, receivers will get a destroyed message for each item.
 
void setItemEnabled (ID _itemId, bool _enabled=true)
 Will set enabled state of the provided item.
 
void setIsReadOnly (bool _readOnly=true)
 Will set the read only state of the tree If read only, the items can not be edited.
 
void setItemSelected (ID _itemId, bool _selected=true)
 Will set the selected state of the provided item. Will also set the selected state of the items childs if the selectAndDeselectChilds option is true.
 
void setItemVisible (ID _itemId, bool _visible)
 Will set enabled state of the provided item.
 
void setItemText (ID _itemId, const QString &_text)
 Will set the text of the provided item.
 
void setSingleItemSelected (ID _itemId, bool _selected)
 Will set the selected state of the provided item. Will not change the selected state of the childs item even if the selectAndDeselectChilds option is true.
 
void toggleItemSelection (ID _itemId)
 Will toggle the selected state of the provided item. Will also set the selected state of the items childs if the selectAndDeselectChilds option is true.
 
void deselectAllItems (bool _emitEvent)
 Will deselect all items.
 
void setEnabled (bool _enabled=true)
 Will set the enabled state of this tree.
 
void setVisible (bool _visible=true)
 Will set the visible state of this tree.
 
void setItemIcon (ID _itemId, const QIcon &_icon)
 Will set the item icon of the specified item.
 
void setSortingEnabled (bool _enabled)
 Will set the sorting enabled flag for this tree.
 
void setFilterVisible (bool _visible)
 Will set the visible mode of the filter lineedit.
 
void applyCurrentFilter (void)
 Will refresh the tree by means of the current filter If the filter is empty (length = 0) all items will be shown.
 
void setFilterCaseSensitive (bool _caseSensitive, bool _refresh=true)
 Will set the case sensitive mode for the filter.
 
void setFilterRefreshOnChange (bool _refreshOnChange)
 Will set the filter refresh on change mode.
 
void setMultiSelectionEnabled (bool _multiSelection)
 Enables or disables the ability to select multiple tree items.
 
void setAutoSelectAndDeselectChildrenEnabled (bool _enabled)
 Enables or disables the ability to automatically select/deselect the childrens of an item.
 
void expandAllItems (void)
 Will expand all items in this tree.
 
void expandItem (ak::ID _itemID, bool _expanded)
 
bool isItemExpanded (ak::ID _itemID)
 
void collapseAllItems (void)
 Will collapse all items in this tree.
 
void deleteItem (ID _itemID, bool _supressSelectionChangedEvent=false)
 Will delete the provided item from this tree.
 
void deleteItems (const std::vector< ID > &_itemIDs, bool _supressSelectionChangedEvent=false)
 Will delete the provided items from this tree.
 
void setItemsAreEditable (bool _editable=true, bool _applyToAll=true)
 Will set the items are editable flag.
 
void setItemIsEditable (ID _itemID, bool _editable)
 Will set the editable flag of one item.
 
void setItemIsEditable (const std::vector< ID > &_itemIDs, bool _editable)
 Will set the editable flag of the provided items item.
 
void setItemSelectChildren (ID _itemID, bool _selectChildren)
 Will set the select children flag of one item.
 
void setChildItemsVisibleWhenApplyingFilter (bool _visible)
 If true all child of the matching item will be visible (not expanded)
 
std::vector< IDselectedItems (void)
 Returns a list of all selected items.
 
std::vector< QString > getItemPath (ID _itemId)
 Will return all items from root to specified item as a vector where the first item is the root item.
 
QString getItemPathString (ID _itemId, char _delimiter='|')
 Will return all items from root to specified item as a string seperated with the provided delimiter where the first item is the root item.
 
ID getItemID (const QString &_itemPath, char _delimiter='|')
 Will return the ID of the specified item.
 
QString getItemText (ID _itemId)
 Will return the text of the specified item.
 
aTreeWidgetItemitem (ID _itemID)
 Will return the item with the specified ID.
 
aTreeWidgetItemitemFromPath (const QString &_itemPath, char _delimiter='|')
 
bool enabled () const
 Will return the enabled state of this tree.
 
int itemCount (void) const
 Will return the count of items in this tree.
 
bool isSortingEnabled (void) const
 Will return the sorting enabled state.
 
bool isReadOnly (void) const
 
bool getAutoSelectAndDeselectChildrenEnabled (void)
 
bool getMultiSelectionEnabled (void)
 
aTreeWidgetBasetreeWidget (void)
 
aLineEditWidgetfilterWidget (void)
 
void selectionChangedEvent (bool _emitEvent=true)
 Will send a event message to the messaging system in the name of the provided tree widget item.
 
aTreeWidgetItemitemAt (const QPoint &_pos)
 
- Public Member Functions inherited from ak::aWidget
 aWidget (objectType _type=otNone, UID _UID=invalidUID)
 Constructor.
 
virtual ~aWidget ()
 Deconstructor.
 
virtual bool isWidgetType (void) const override
 Returns true the object is derived from aWidget.
 
- Public Member Functions inherited from ak::aObject
 aObject (objectType _type=otNone, UID _UID=ak::invalidUID)
 Constructor.
 
 aObject (const aObject &_other)
 Copy constructor.
 
aObjectoperator= (const aObject &_other)
 Assignment operator.
 
virtual ~aObject ()
 Deconstructor.
 
virtual void removeChildObject (aObject *_child)
 Will remove the child from this object (not destroy it) This function should be called from the deconstructor of a child.
 
virtual void addChildObject (aObject *_child)
 Will add the child to this object.
 
void setUniqueName (const QString &_name)
 Will set this objects unique name.
 
virtual void setParentObject (aObject *_parentObject)
 Will set the parent object of this object.
 
QString uniqueName (void) const
 Will return the unique name of this object.
 
aObjectparentObject (void) const
 Will return a pointer to the parent object.
 
int childObjectCount (void) const
 Will return the count of sub objects.
 
aObjectchildObject (UID _childUID)
 Will return the child with the specified UID.
 
void setOwner (aObject *_object)
 Will set the owner of this object.
 
aObjectowner (void) const
 Will return the owner of this object.
 
void setUid (UID _UID)
 Will set the objects UID.
 
UID uid (void) const
 Returns the objects UID.
 
objectType type (void) const
 Returns the objects type.
 

Friends

class aTreeWidgetBase
 

Additional Inherited Members

- Protected Attributes inherited from ak::aObject
UID m_uid
 
int m_references
 The objects UID.
 
objectType m_objectType
 The objects references.
 
QString m_uniqueName
 The object type of this object.
 
aObjectm_parentObject
 
aObjectm_owner
 
std::map< UID, aObject * > m_childObjects
 

Constructor & Destructor Documentation

◆ aTreeWidget()

ak::aTreeWidget::aTreeWidget ( )

Default constructor.

Parameters
_messengerThe globally used messenger
_uidManagerThe globally used UID manager
_dockThe dock widget to display the tree at

◆ ~aTreeWidget()

ak::aTreeWidget::~aTreeWidget ( )
virtual

Deconstructor.

Member Function Documentation

◆ add() [1/2]

ak::ID ak::aTreeWidget::add ( const QString & _cmd,
char _delimiter = '|',
ak::textAlignment _textAlignment = alignLeft,
const QIcon & _icon = QIcon() )

Will add new items to the tree according to the provided command The command consists of the root item and the childs. The command may look like this: root|child|child2 In this case the delimiter will be the '|' and the tree will get a root item with the text "root" (if doesnt exist before) The root gets a child item with the text "child" and the child gets a child with the text "child2", so the tree looks like this: ->root ->->child ->->->child2 The very last item will also get the alignment, colors and icon set. Will return the UID of the very last item.

Parameters
_cmdThe tree command
_delimiterThe delimiter used in the command which seperates the items

◆ add() [2/2]

ak::ID ak::aTreeWidget::add ( ak::ID _parentId = -1,
const QString & _text = "",
ak::textAlignment _textAlignment = alignLeft,
QIcon _icon = QIcon() )

Will add a new item to the tree widget and return its ID.

Parameters
_parentUidThe ID of the parent item. If Id is -1, the item will be added as top level item

◆ applyCurrentFilter()

void ak::aTreeWidget::applyCurrentFilter ( void )

Will refresh the tree by means of the current filter If the filter is empty (length = 0) all items will be shown.

◆ clear()

void ak::aTreeWidget::clear ( bool _emitEvent = true)

Will clear all tree items, receivers will get a destroyed message for each item.

◆ cleared

void ak::aTreeWidget::cleared ( void )
signal

◆ collapseAllItems()

void ak::aTreeWidget::collapseAllItems ( void )

Will collapse all items in this tree.

◆ customContextMenuRequested

void ak::aTreeWidget::customContextMenuRequested ( const QPoint & _pos)
signal

◆ deleteItem()

void ak::aTreeWidget::deleteItem ( ak::ID _itemID,
bool _supressSelectionChangedEvent = false )

Will delete the provided item from this tree.

Parameters
_itemThe item to delete

◆ deleteItems()

void ak::aTreeWidget::deleteItems ( const std::vector< ID > & _itemIDs,
bool _supressSelectionChangedEvent = false )

Will delete the provided items from this tree.

Parameters
_itemsThe items to delete

◆ deselectAllItems()

void ak::aTreeWidget::deselectAllItems ( bool _emitEvent)

Will deselect all items.

Parameters
_emitEventIf true a selection changed signal will be emitted

◆ enabled()

bool ak::aTreeWidget::enabled ( ) const

Will return the enabled state of this tree.

◆ expandAllItems()

void ak::aTreeWidget::expandAllItems ( void )

Will expand all items in this tree.

◆ expandItem()

void ak::aTreeWidget::expandItem ( ak::ID _itemID,
bool _expanded )

◆ filterWidget()

aLineEditWidget * ak::aTreeWidget::filterWidget ( void )
inline

◆ focusLost

void ak::aTreeWidget::focusLost ( void )
signal

◆ getAutoSelectAndDeselectChildrenEnabled()

bool ak::aTreeWidget::getAutoSelectAndDeselectChildrenEnabled ( void )
inline

◆ getItemID()

ak::ID ak::aTreeWidget::getItemID ( const QString & _itemPath,
char _delimiter = '|' )

Will return the ID of the specified item.

Parameters
_itemPathThe path of the requested item
_delimiterThe delimiter of the item path

◆ getItemPath()

std::vector< QString > ak::aTreeWidget::getItemPath ( ak::ID _itemId)

Will return all items from root to specified item as a vector where the first item is the root item.

Parameters
_itemIdThe ID of the requested item

◆ getItemPathString()

QString ak::aTreeWidget::getItemPathString ( ak::ID _itemId,
char _delimiter = '|' )

Will return all items from root to specified item as a string seperated with the provided delimiter where the first item is the root item.

Parameters
_itemIdThe ID of the requested item
_delimiterThe delimiter between the items

◆ getItemText()

QString ak::aTreeWidget::getItemText ( ak::ID _itemId)

Will return the text of the specified item.

Parameters
_itemIdThe ID of the item to get the text of

◆ getMultiSelectionEnabled()

bool ak::aTreeWidget::getMultiSelectionEnabled ( void )

◆ isItemExpanded()

bool ak::aTreeWidget::isItemExpanded ( ak::ID _itemID)

◆ isReadOnly()

bool ak::aTreeWidget::isReadOnly ( void ) const
inline

◆ isSortingEnabled()

bool ak::aTreeWidget::isSortingEnabled ( void ) const

Will return the sorting enabled state.

◆ item()

ak::aTreeWidgetItem * ak::aTreeWidget::item ( ID _itemID)

Will return the item with the specified ID.

Parameters
_itemIDThe ID of the item

◆ itemActivated

void ak::aTreeWidget::itemActivated ( QTreeWidgetItem * ,
int  )
signal

◆ itemAt()

ak::aTreeWidgetItem * ak::aTreeWidget::itemAt ( const QPoint & _pos)

◆ itemChanged

void ak::aTreeWidget::itemChanged ( QTreeWidgetItem * ,
int  )
signal

◆ itemClicked

void ak::aTreeWidget::itemClicked ( QTreeWidgetItem * ,
int  )
signal

◆ itemCollapsed

void ak::aTreeWidget::itemCollapsed ( QTreeWidgetItem * )
signal

◆ itemCount()

int ak::aTreeWidget::itemCount ( void ) const

Will return the count of items in this tree.

◆ itemDoubleClicked

void ak::aTreeWidget::itemDoubleClicked ( QTreeWidgetItem * ,
int  )
signal

◆ itemExpanded

void ak::aTreeWidget::itemExpanded ( QTreeWidgetItem * )
signal

◆ itemFocused

void ak::aTreeWidget::itemFocused ( QTreeWidgetItem * )
signal

◆ itemFromPath()

ak::aTreeWidgetItem * ak::aTreeWidget::itemFromPath ( const QString & _itemPath,
char _delimiter = '|' )

◆ itemLocationChanged

void ak::aTreeWidget::itemLocationChanged ( QTreeWidgetItem * ,
int  )
signal

◆ itemsMoved

void ak::aTreeWidget::itemsMoved ( const QList< ID > & _itemIds,
const QList< ID > & _oldParentIds,
const QList< ID > & _newParentIds )
signal

◆ itemTextChanged

void ak::aTreeWidget::itemTextChanged ( QTreeWidgetItem * ,
int  )
signal

◆ keyPressed

void ak::aTreeWidget::keyPressed ( QKeyEvent * )
signal

◆ keyReleased

void ak::aTreeWidget::keyReleased ( QKeyEvent * )
signal

◆ selectedItems()

std::vector< ak::ID > ak::aTreeWidget::selectedItems ( void )

Returns a list of all selected items.

◆ selectionChanged

void ak::aTreeWidget::selectionChanged ( void )
signal

◆ selectionChangedEvent()

void ak::aTreeWidget::selectionChangedEvent ( bool _emitEvent = true)

Will send a event message to the messaging system in the name of the provided tree widget item.

Parameters
_itemThe sender
_eventTypeThe type of the event
_info1Additional information 1
_info2Additional information 2

Will perform the selection changed event

Parameters
_emitEventIf true a selection changed signal will be emitted

◆ setAutoSelectAndDeselectChildrenEnabled()

void ak::aTreeWidget::setAutoSelectAndDeselectChildrenEnabled ( bool _enabled)

Enables or disables the ability to automatically select/deselect the childrens of an item.

Parameters
_enabledif true, the childs of an item will be selected/deselected automatically

◆ setChildItemsVisibleWhenApplyingFilter()

void ak::aTreeWidget::setChildItemsVisibleWhenApplyingFilter ( bool _visible)
inline

If true all child of the matching item will be visible (not expanded)

◆ setEnabled()

void ak::aTreeWidget::setEnabled ( bool _enabled = true)

Will set the enabled state of this tree.

◆ setFilterCaseSensitive()

void ak::aTreeWidget::setFilterCaseSensitive ( bool _caseSensitive,
bool _refresh = true )

Will set the case sensitive mode for the filter.

Parameters
_caseSensitiveIf true, the filter is case sensitive
_refreshIf true, the filter will be checked with the new setting

◆ setFilterRefreshOnChange()

void ak::aTreeWidget::setFilterRefreshOnChange ( bool _refreshOnChange)

Will set the filter refresh on change mode.

Parameters
_refreshOnChangeIf true, the filter will always be applied when he changes, othewise only on return pressed

◆ setFilterVisible()

void ak::aTreeWidget::setFilterVisible ( bool _visible)

Will set the visible mode of the filter lineedit.

Parameters
_visibleIf true, the filter lineedit will be visible

◆ setIsReadOnly()

void ak::aTreeWidget::setIsReadOnly ( bool _readOnly = true)

Will set the read only state of the tree If read only, the items can not be edited.

Parameters
_readOnlyThe read only state to set

◆ setItemEnabled()

void ak::aTreeWidget::setItemEnabled ( ak::ID _itemId,
bool _enabled = true )

Will set enabled state of the provided item.

Parameters
_itemIdThe ID of the item
_enabledThe enabled state of the item

◆ setItemIcon()

void ak::aTreeWidget::setItemIcon ( ak::ID _itemId,
const QIcon & _icon )

Will set the item icon of the specified item.

Parameters
_itemIdThe ID of the item to set the icon at
_iconThe icon to set

◆ setItemIsEditable() [1/2]

void ak::aTreeWidget::setItemIsEditable ( const std::vector< ID > & _itemIDs,
bool _editable )

Will set the editable flag of the provided items item.

Parameters
_itemThe item id
_editableIf true, the item can be modified by the user

◆ setItemIsEditable() [2/2]

void ak::aTreeWidget::setItemIsEditable ( ak::ID _itemID,
bool _editable )

Will set the editable flag of one item.

Parameters
_itemThe item id
_editableIf true, the item can be modified by the user

◆ setItemsAreEditable()

void ak::aTreeWidget::setItemsAreEditable ( bool _editable = true,
bool _applyToAll = true )

Will set the items are editable flag.

Parameters
_editableIf true, the items can be modified by the user
_applyToAllIf true, then the new state will be applied to all existing items, otherwise this chane will only affect items created after this point

◆ setItemSelectChildren()

void ak::aTreeWidget::setItemSelectChildren ( ak::ID _itemID,
bool _selectChildren )

Will set the select children flag of one item.

Parameters
_itemThe item id
_editableIf true, the item will select its children when it is selected

◆ setItemSelected()

void ak::aTreeWidget::setItemSelected ( ak::ID _itemId,
bool _selected = true )

Will set the selected state of the provided item. Will also set the selected state of the items childs if the selectAndDeselectChilds option is true.

Parameters
_itemIdThe ID of the item
_selectedThe selected state of the item

◆ setItemText()

void ak::aTreeWidget::setItemText ( ak::ID _itemId,
const QString & _text )

Will set the text of the provided item.

Parameters
_itemIdThe ID of the item
_textThe text to set

◆ setItemVisible()

void ak::aTreeWidget::setItemVisible ( ak::ID _itemId,
bool _visible )

Will set enabled state of the provided item.

Parameters
_itemIdThe ID of the item
_enabledThe enabled state of the item

◆ setMultiSelectionEnabled()

void ak::aTreeWidget::setMultiSelectionEnabled ( bool _multiSelection)

Enables or disables the ability to select multiple tree items.

Parameters
_multiSelectionSpecify whether multiple items can be selected

◆ setSingleItemSelected()

void ak::aTreeWidget::setSingleItemSelected ( ak::ID _itemId,
bool _selected )

Will set the selected state of the provided item. Will not change the selected state of the childs item even if the selectAndDeselectChilds option is true.

Parameters
_itemIdThe ID of the item
_selectedThe selected state of the item

◆ setSortingEnabled()

void ak::aTreeWidget::setSortingEnabled ( bool _enabled)

Will set the sorting enabled flag for this tree.

Parameters
_enabledThe enabled state to set

◆ setVisible()

void ak::aTreeWidget::setVisible ( bool _visible = true)

Will set the visible state of this tree.

◆ slotCustomContextMenuRequested

void ak::aTreeWidget::slotCustomContextMenuRequested ( const QPoint & _pos)
slot

◆ slotFilterKeyPressed

void ak::aTreeWidget::slotFilterKeyPressed ( QKeyEvent * _event)
slot

Will perform actions on the filter enter pressed event.

◆ slotFilterTextChanged

void ak::aTreeWidget::slotFilterTextChanged ( void )
slot

Will perform actions on the filter text changed event.

◆ slotTreeItemActivated

void ak::aTreeWidget::slotTreeItemActivated ( QTreeWidgetItem * _item,
int _column )
slot

◆ slotTreeItemChanged

void ak::aTreeWidget::slotTreeItemChanged ( QTreeWidgetItem * _item,
int _column )
slot

◆ slotTreeItemClicked

void ak::aTreeWidget::slotTreeItemClicked ( QTreeWidgetItem * _item,
int _column )
slot

◆ slotTreeItemCollapsed

void ak::aTreeWidget::slotTreeItemCollapsed ( QTreeWidgetItem * _item)
slot

◆ slotTreeItemDoubleClicked

void ak::aTreeWidget::slotTreeItemDoubleClicked ( QTreeWidgetItem * _item,
int _column )
slot

◆ slotTreeItemExpanded

void ak::aTreeWidget::slotTreeItemExpanded ( QTreeWidgetItem * _item)
slot

◆ slotTreeKeyPressed

void ak::aTreeWidget::slotTreeKeyPressed ( QKeyEvent * _event)
slot

◆ slotTreeKeyReleased

void ak::aTreeWidget::slotTreeKeyReleased ( QKeyEvent * _event)
slot

◆ slotTreeLeave

void ak::aTreeWidget::slotTreeLeave ( QEvent * _event)
slot

◆ slotTreeMouseMove

void ak::aTreeWidget::slotTreeMouseMove ( QMouseEvent * _event)
slot

◆ slotTreeSelectionChanged

void ak::aTreeWidget::slotTreeSelectionChanged ( )
slot

◆ toggleItemSelection()

void ak::aTreeWidget::toggleItemSelection ( ak::ID _itemId)

Will toggle the selected state of the provided item. Will also set the selected state of the items childs if the selectAndDeselectChilds option is true.

Parameters
_itemIdThe ID of the item
_selectedThe selected state of the item

◆ treeWidget()

aTreeWidgetBase * ak::aTreeWidget::treeWidget ( void )
inline

◆ widget()

QWidget * ak::aTreeWidget::widget ( void )
overridevirtual

Will return the widgets widget to display it.

Implements ak::aWidget.

Friends And Related Symbol Documentation

◆ aTreeWidgetBase

friend class aTreeWidgetBase
friend

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