class KTreeList

In file ../ui/ktreelist.h:

## class KTreeList : public QTableView

> A treelist widget like in Win95/NT

## Inheritance:

## Documentation

> 1. Introduction 2. Features 3. Installation 4. Public interface

> 1. Introduction ================================================================================

> KTreeList is a class inherited from QTableView in the Qt user interface library. It provides a way to display hierarchical data in a single-inheritance tree, similar to tree controls in Microsoft Windows and other GUI's. It is most suitable for directory trees or outlines, but I'm sure other uses will come to mind. Frankly, it was designed mostly with the above two functions in mind, but I have tried to make it as flexible as I know how to make it easy to adapt to other uses.

> In case of problems, I encourage you to read all of the other documentation files in this package before contacting me as you may find the answer to your question in one of them. Also read the source code if you have time. I have tried to comment it adequately and make the source understandable.

> 2. Features ================================================================================

> * Displays both text and optional pixmap supplied by the programmer. A support class, KTreeListItem, can be inherited and modified to draw items as needed by the programmer.

> * The list items can be returned by index or logical path and the tree navigated by parent, child or sibling references contained in them. Also, item information such as text, pixmap, branch level can be obtained.

> * Items can be inserted, changed and removed either by index in the visible structure, or by logical paths through the tree hierarchy.

> * The logical path through the tree for any item can be obtained with the index of the item.

> * Tree structure display and expanding/collapsing of sub-trees is handled with no intervention from the programmer.

> * entire tree can be expanded or collapsed to a specified sub-level (handy for outline views)

> * Configuration as follows:

> enable/disable item text display (if you only want to display pixmaps)

> enable/disable drawing of expand/collapse button

> enable/disable drawing of tree structure

> * Keyboard support as follows:

> up/down arrows move the highlight appropriately and scroll the list an item at a time, if necessary

> pgup/pgdn move the highlight a 'page' up or down as applicable and scroll the view

> +/- keys expand/collapse the highlighted item if it appropriate

> enter key selects the highlighted item

> * Mouse support as follows:

> left click on item highlights it

> left click on an item "hot button" expands or collapses its sub-tree, as applicable

> double click on item selects it

> normal scrolling functions in conjunction with scrollbars if present

> * Signals/Slots

> signal void highlighted(int) - emitted when an item in the tree is highlighted; sends the index of the item

> signal void selected(int) - emitted when an item in the tree is selected; sends the index of the item

> signal void expanded(int) - emitted when an item in the tree is expanded; sends the index of the item

> signal void collpased(int) - emitted when an item in the tree is collapsed; sends the index of the item

> Widget contructor. Passes all parameters on to base QTableView, and does not use them directly. Does internal initialization, sets the current item to -1, and sets default values for scroll bars (both auto) and grid snap (snap to grid vertically).

> Adds a new item to the tree with the given text and pixmap as a child of the item currently at the given index. If the current item already has children, the new item is appended below them.

> Same as above except parent item is specified by path.

> Adds the given item as a child of the item currently at the given index. If the current item already has children, the new item is appended below them.

> Same as above except parent item is specified by path.

> Returns a bool value indicating whether the list will display a horizontal scrollbar if one of the displayed items is wider than can be displayed at the current width of the view.

> Returns a bool value indicating whether the list will display a vertical scrollbar if the number of displayed items is more than can be displayed at the current height of the view.

> Returns a bool value indicating whether the list will update immediately on changing the state of the widget in some way.

> Returns a bool value indicating whether the list has currently has a horizontal scroll bar.

> Changes the text and/or pixmap of the given item at the specified index to the given values and updates the display if auto update enabled. If changing only the text or pixmap, set the other parameter to 0.

> Same as above function, except item to change is specified by a path through the tree.

> Removes all items from the tree.

> Returns the total number of items in the tree, whether visible (expanded sub-trees) or not (collapsed).

> Returns the index of the current (highlighted) item. If no current item, returns -1.

> Collapses the sub-tree at the specified index.

> Expands the sub-tree at the specified index.

> Returns the depth to which all parent items are automatically expanded.

> Same as above functions combined into one. If sub-tree is expanded, collapses it, if it is collapsed, it expands it.

> Iterates every item in the tree, visible or not, and applies the function func with a pointer to each item and user data supplied as parameters. KForEveryFunc is defined as:

> typedef void (*KForEveryFunc)(KTreeListItem *, void *);

> That is, a function that returns void and takes a pointer to a KTreeListItem and pointer to void as parameters.

> Same as above, but only iterates visible items, in order.

> Returns a pointer to the current item if there is one, or 0.

> Returns the number of pixels an item is indented for each level.

> Inserts an item into the tree with the given text and pixmap either before or after the item currently at the given index, depending on the value of prefix. The new item is added to the same branch as the reference item. If index is -1, the item is simply appended to the tree at the root level. The item text must not be null.

> Same as above, but uses a path through the tree to reference the insert position.

> Inserts the given item into the tree either before or after the item currently at the given index, depending on the value of prefix. The new item is add to the same branch as the reference item. If index is -1, the item is simply appended to the tree at the root level. The item text must not be null.

> Same as above, but uses a path through the tree to reference the insert position.

> Returns a pointer to the item at index.

> Returns a pointer ot the item at the end of thePath.

> Returns the index of the given item in the visible tree or -1 if not found.

> Returns a pointer to the logical path to the item at the specified index. The return KPath object must be deleted by the caller. Any strings still contained in the stack will be automatically deleted, but any popped from the path must also be deleted by the caller.

> Outdents the item at the given index one level so that it becomes a sibling of its parent.

> Moves the item at the specified index down one slot in its current branch.

> Same as above but uses a path to specify the item.

> Moves the item at the specified index up one slot in its current branch.

> Same as above but uses a path to specify the item.

> Removes the item at the specified index.

> Same as above except uses path through the tree to find the item.

> Returns bool value indicating whether the list currently displays a vertical scroll bar.

> If enable is TRUE (default), enables auto update, else disables it.

> If enable is TRUE, displays a horizontal scroll bar, else hides it.

> Makes the item at index current and highlights it.

> If enable is TRUE, displays a vertical scroll bar, else hides it.

> If enable is TRUE (default), item text will be displayed, otherwise it will not, and no highlight will be shown in the default widget.

> If enable is TRUE, enables smooth scrolling, else disables it (default).

> If enable is TRUE (default), lines depicting the structure of the tree will be drawn, otherwise they will not.

> Indicates whether item text is displayed.

> Returns a bool value indicating whether smooth scrolling is enabled.

> Indents the item at the specified index, creating a new branch.

> Same as above but uses a path to specify the item.

> Removes the item at the given index from the tree, but does not delete it, returning a pointer to the removed item.

> Same as above but uses a path to specify the item to take.

> Indicates whether the tree structure is drawn.

> Returns the number of items that are visible (their parents are expanded).

#### this class has no child classes.

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling