#include "aTreeWidget.h"
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< ID > | selectedItems (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. | |
aTreeWidgetItem * | item (ID _itemID) |
Will return the item with the specified ID. | |
aTreeWidgetItem * | itemFromPath (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) |
aTreeWidgetBase * | treeWidget (void) |
aLineEditWidget * | filterWidget (void) |
void | selectionChangedEvent (bool _emitEvent=true) |
Will send a event message to the messaging system in the name of the provided tree widget item. | |
aTreeWidgetItem * | itemAt (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. | |
aObject & | operator= (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. | |
aObject * | parentObject (void) const |
Will return a pointer to the parent object. | |
int | childObjectCount (void) const |
Will return the count of sub objects. | |
aObject * | childObject (UID _childUID) |
Will return the child with the specified UID. | |
void | setOwner (aObject *_object) |
Will set the owner of this object. | |
aObject * | owner (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. | |
aObject * | m_parentObject |
aObject * | m_owner |
std::map< UID, aObject * > | m_childObjects |
ak::aTreeWidget::aTreeWidget | ( | ) |
Default constructor.
_messenger | The globally used messenger |
_uidManager | The globally used UID manager |
_dock | The dock widget to display the tree at |
|
virtual |
Deconstructor.
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.
_cmd | The tree command |
_delimiter | The delimiter used in the command which seperates the items |
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.
_parentUid | The ID of the parent item. If Id is -1, the item will be added as top level item |
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.
void ak::aTreeWidget::clear | ( | bool | _emitEvent = true | ) |
Will clear all tree items, receivers will get a destroyed message for each item.
|
signal |
void ak::aTreeWidget::collapseAllItems | ( | void | ) |
Will collapse all items in this tree.
|
signal |
void ak::aTreeWidget::deleteItem | ( | ak::ID | _itemID, |
bool | _supressSelectionChangedEvent = false ) |
Will delete the provided item from this tree.
_item | The item to delete |
void ak::aTreeWidget::deleteItems | ( | const std::vector< ID > & | _itemIDs, |
bool | _supressSelectionChangedEvent = false ) |
Will delete the provided items from this tree.
_items | The items to delete |
void ak::aTreeWidget::deselectAllItems | ( | bool | _emitEvent | ) |
Will deselect all items.
_emitEvent | If true a selection changed signal will be emitted |
bool ak::aTreeWidget::enabled | ( | ) | const |
Will return the enabled state of this tree.
void ak::aTreeWidget::expandAllItems | ( | void | ) |
Will expand all items in this tree.
void ak::aTreeWidget::expandItem | ( | ak::ID | _itemID, |
bool | _expanded ) |
|
inline |
|
signal |
|
inline |
ak::ID ak::aTreeWidget::getItemID | ( | const QString & | _itemPath, |
char | _delimiter = '|' ) |
Will return the ID of the specified item.
_itemPath | The path of the requested item |
_delimiter | The delimiter of the item path |
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.
_itemId | The ID of the requested item |
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.
_itemId | The ID of the requested item |
_delimiter | The delimiter between the items |
QString ak::aTreeWidget::getItemText | ( | ak::ID | _itemId | ) |
Will return the text of the specified item.
_itemId | The ID of the item to get the text of |
bool ak::aTreeWidget::getMultiSelectionEnabled | ( | void | ) |
bool ak::aTreeWidget::isItemExpanded | ( | ak::ID | _itemID | ) |
|
inline |
bool ak::aTreeWidget::isSortingEnabled | ( | void | ) | const |
Will return the sorting enabled state.
ak::aTreeWidgetItem * ak::aTreeWidget::item | ( | ID | _itemID | ) |
Will return the item with the specified ID.
_itemID | The ID of the item |
|
signal |
ak::aTreeWidgetItem * ak::aTreeWidget::itemAt | ( | const QPoint & | _pos | ) |
|
signal |
|
signal |
|
signal |
int ak::aTreeWidget::itemCount | ( | void | ) | const |
Will return the count of items in this tree.
|
signal |
|
signal |
|
signal |
ak::aTreeWidgetItem * ak::aTreeWidget::itemFromPath | ( | const QString & | _itemPath, |
char | _delimiter = '|' ) |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
std::vector< ak::ID > ak::aTreeWidget::selectedItems | ( | void | ) |
Returns a list of all selected items.
|
signal |
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.
_item | The sender |
_eventType | The type of the event |
_info1 | Additional information 1 |
_info2 | Additional information 2 |
Will perform the selection changed event
_emitEvent | If true a selection changed signal will be emitted |
void ak::aTreeWidget::setAutoSelectAndDeselectChildrenEnabled | ( | bool | _enabled | ) |
Enables or disables the ability to automatically select/deselect the childrens of an item.
_enabled | if true, the childs of an item will be selected/deselected automatically |
|
inline |
If true all child of the matching item will be visible (not expanded)
void ak::aTreeWidget::setEnabled | ( | bool | _enabled = true | ) |
Will set the enabled state of this tree.
void ak::aTreeWidget::setFilterCaseSensitive | ( | bool | _caseSensitive, |
bool | _refresh = true ) |
Will set the case sensitive mode for the filter.
_caseSensitive | If true, the filter is case sensitive |
_refresh | If true, the filter will be checked with the new setting |
void ak::aTreeWidget::setFilterRefreshOnChange | ( | bool | _refreshOnChange | ) |
Will set the filter refresh on change mode.
_refreshOnChange | If true, the filter will always be applied when he changes, othewise only on return pressed |
void ak::aTreeWidget::setFilterVisible | ( | bool | _visible | ) |
Will set the visible mode of the filter lineedit.
_visible | If true, the filter lineedit will be visible |
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.
_readOnly | The read only state to set |
void ak::aTreeWidget::setItemEnabled | ( | ak::ID | _itemId, |
bool | _enabled = true ) |
Will set enabled state of the provided item.
_itemId | The ID of the item |
_enabled | The enabled state of the item |
void ak::aTreeWidget::setItemIcon | ( | ak::ID | _itemId, |
const QIcon & | _icon ) |
Will set the item icon of the specified item.
_itemId | The ID of the item to set the icon at |
_icon | The icon to set |
void ak::aTreeWidget::setItemIsEditable | ( | const std::vector< ID > & | _itemIDs, |
bool | _editable ) |
Will set the editable flag of the provided items item.
_item | The item id |
_editable | If true, the item can be modified by the user |
void ak::aTreeWidget::setItemIsEditable | ( | ak::ID | _itemID, |
bool | _editable ) |
Will set the editable flag of one item.
_item | The item id |
_editable | If true, the item can be modified by the user |
void ak::aTreeWidget::setItemsAreEditable | ( | bool | _editable = true, |
bool | _applyToAll = true ) |
Will set the items are editable flag.
_editable | If true, the items can be modified by the user |
_applyToAll | If true, then the new state will be applied to all existing items, otherwise this chane will only affect items created after this point |
void ak::aTreeWidget::setItemSelectChildren | ( | ak::ID | _itemID, |
bool | _selectChildren ) |
Will set the select children flag of one item.
_item | The item id |
_editable | If true, the item will select its children when it is selected |
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.
_itemId | The ID of the item |
_selected | The selected state of the item |
void ak::aTreeWidget::setItemText | ( | ak::ID | _itemId, |
const QString & | _text ) |
Will set the text of the provided item.
_itemId | The ID of the item |
_text | The text to set |
void ak::aTreeWidget::setItemVisible | ( | ak::ID | _itemId, |
bool | _visible ) |
Will set enabled state of the provided item.
_itemId | The ID of the item |
_enabled | The enabled state of the item |
void ak::aTreeWidget::setMultiSelectionEnabled | ( | bool | _multiSelection | ) |
Enables or disables the ability to select multiple tree items.
_multiSelection | Specify whether multiple items can be selected |
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.
_itemId | The ID of the item |
_selected | The selected state of the item |
void ak::aTreeWidget::setSortingEnabled | ( | bool | _enabled | ) |
Will set the sorting enabled flag for this tree.
_enabled | The enabled state to set |
void ak::aTreeWidget::setVisible | ( | bool | _visible = true | ) |
Will set the visible state of this tree.
|
slot |
|
slot |
Will perform actions on the filter enter pressed event.
|
slot |
Will perform actions on the filter text changed event.
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
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.
_itemId | The ID of the item |
_selected | The selected state of the item |
|
inline |
|
overridevirtual |
Will return the widgets widget to display it.
Implements ak::aWidget.
|
friend |