Source Code (Use browser search to find items of interest.)
Class Index
ksirc'KItemSearchInfo (./kdenetwork/ksirc/ktreelist.h:205)
struct KItemSearchInfo {
int count;
int index;
KTreeListItem *foundItem;
KItemSearchInfo() : count(0), index(0), foundItem(0) {}
};
/**
A collapsible treelist widget.
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
2nd scrolling with the middle mouse button: pressing MMB inserts a
rubberband, showing which part of the whole tree is currently visible.
moving the mouse will scroll the visible part
* 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
*/
ksirc'KItemSearchInfo::KItemSearchInfo() (./kdenetwork/ksirc/ktreelist.h:209)
KItemSearchInfo() : count(0), index(0), foundItem(0) {}
};
/**
A collapsible treelist widget.
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
2nd scrolling with the middle mouse button: pressing MMB inserts a
rubberband, showing which part of the whole tree is currently visible.
moving the mouse will scroll the visible part
* 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
*/