The Qt documentation in C++ of this class can be read here: http://doc.trolltech.com/4.3/qtreewidget.html
A control providing information in a tree structure.
Please read the control class overview Control as well.
Whenever you use Index, KBasic checks if Index is greater equal 1 and smaller equal Length(). If not, the command will not be executed, e.g. You use Insert(10, “test”), but there are only 4 elements yet, the Insert will fail. First element has got Index = 1.
Delete all items works as follow: |
Private Sub CommandButton11_OnEvent() Dim id As Integer = TreeView1.InvisibleRootItem() Dim n As Integer = TreeView1.ChildCount(id) Dim child As Integer For i As Integer = 1 To n child = TreeView1.Child(id, i) If TreeView1.ChildCount(child) > 0 Then DeleteTreeViewItem(child) TreeView1.RemoveChild(id, i) n = n - 1 i = i - 1 Next End Sub
Function AppendChild(Caption As String) As Integer
Function AppendChild(Icon As String, Caption As String) As Integer
Function AppendChild(Id As Integer, Caption As String) As Integer
Function AppendChild(Id As Integer, Icon As String, Caption As String) As Integer
Might be a String containing binary data. See the binary project example for using.
Function ChildCount(Id As Integer) As Integer
Function Child(Id As Integer, Index As Integer) As Integer
Function Tag(Id As Integer, Column As Integer) As String
Sub SetTag(Id As Integer, Column As Integer, Tag As String)
Function CheckState(Id As Integer, Column As Integer) As String
Sub SetCheckState(Id As Integer, Column As Integer, CheckState As String)
Function Data(Id As Integer) As Integer
Function Flag(Id As Integer) As String
Sub SetFlag(Id As Integer, Flag As String)
Flag | Qt documentation says |
ItemIsSelectable | It can be selected. |
ItemIsEditable | It can be edited. |
ItemIsDragEnabled | It can be dragged. |
ItemIsDropEnabled | It can be used as a drop target. |
ItemIsUserCheckable | It can be checked or unchecked by the user. |
ItemIsEnabled | The user can interact with the item. |
ItemIsTristate | The item is checkable with three separate states. |
Sub SetBackground(Id As Integer, Column As Integer, ColorId As String)
Sub SetBackground(Id As Integer, Column As Integer, ColorId As String, BrushStyle As String)
Sub SetFontColor(Id As Integer, Column As Integer, ColorId As String)
Sub SetFontColor(Id As Integer, Column As Integer, ColorId As String, BrushStyle As String)
Sub SetFont(Id As Integer, Column As Integer, FontId As String)
Function Caption(Id As Integer, Column As Integer) As String
Sub SetCaption(Id As Integer, Column As Integer, Caption As String)
Sub SetIcon(Id As Integer, Column As Integer, Icon As String)
Function IndexOfChild(Id As Integer, ChildId As Integer) As Integer
Function InsertChild(Id As Integer, Index As Integer, Caption As String) As Integer
Function InsertChild(Id As Integer, Index As Integer, Icon As String, Caption As String) As Integer
Function IsExpanded(Id As Integer) As Boolean
Sub SetExpanded(Id As Integer, IsExpanded As Boolean)
Function IsHidden(Id As Integer) As Boolean
Sub SetHidden(Id As Integer, IsHidden As Boolean)
Function IsSelected(Id As Integer) As Boolean
Function StatusTip(Id As Integer, Column As Integer) As String
Sub SetStatusTip(Id As Integer, Column As Integer, StatusTip As String)
Function ToolTip(Id As Integer, Column As Integer) As String
Sub SetToolTip(Id As Integer, Column As Integer, ToolTip As String)
Sub RemoveChild(Id As Integer, Index As Integer)
Function TextAlignment(Id As Integer, Column As Integer) As String
Sub SetTextAlignment(Id As Integer, Column As Integer, TextAlignment As String)
Possible Value | Description (Qt documentation says) |
AlignLeft | Aligns with the left edge. |
AlignRight | Aligns with the right edge. |
AlignHCenter | Centers horizontally in the available space. |
AlignJustify | Justifies the text in the available space. |
AlignTop | Aligns with the top. |
AlignBottom | Aligns with the bottom. |
AlignVCenter | Centers vertically in the available space. |
AlignCenter | Centers in both dimensions. |
AlignAbsolute | If the widget's layout direction is RightToLeft (instead of LeftToRight, the default), AlignLeft refers to the right edge and AlignRight to the left edge. This is normally the desired behavior. If you want AlignLeft to always mean “left” and AlignRight to always mean “right”, combine the flag with AlignAbsolute. |
AlignLeading | Synonym for AlignLeft. |
AlignTrailing | Synonym for AlignRight. |
AlignHorizontal_Mask | AlignLeft Or AlignRight Or AlignHCenter Or AlignJustify Or AlignAbsolute |
AlignVertical_Mask | AlignTop Or AlignBottom Or AlignVCenter |
Function ColumnCount(Id As Integer) As Integer
Function Append(Caption As String) As Integer
Function Append(Icon As String, Caption As String) As Integer
Sub ClosePersistentEditor(Id As Integer, Column As Integer)
Normally, you would not call this sub.
Function ColumnCount() As Integer
Function CurrentColumn() As Integer
Function CurrentItem() As Integer
Function FindItem(Caption As String, Flag As String, Column As Integer) As Integer
Flag | Qt documentation says |
MatchExactly | Performs QVariant-based matching. |
MatchFixedString | Performs string-based matching. String-based comparisons are case-insensitive unless the MatchCaseSensitive flag is also specified. |
MatchContains | The search term is contained in the item. |
MatchStartsWith | The search term matches the start of the item. |
MatchEndsWith | The search term matches the end of the item. |
MatchCaseSensitive | The search is case sensitive. |
MatchRegExp | Performs string-based matching using a regular expression as the search term. |
MatchWildcard | Performs string-based matching using a string with wildcards as the search term. |
MatchWrap | Perform a search that wraps around, so that when the search reaches the last item in the model, it begins again at the first item and continues until all items have been examined. |
MatchRecursive | Searches the entire hierarchy. |
Function HeaderItem() As Integer
Function IndexOfTopLevelItem(Id As Integer) As Integer
Function Insert(Index As Integer, Caption As String) As Integer
Function Insert(Index As Integer, Icon As String, Caption As String) As Integer
Function InvisibleRootItem() As Integer
Function ItemAt(X As Integer, Y As Integer) As Integer
Returns the item at position X/Y.
Sub OpenPersistentEditor(Id As Integer, Column As Integer)
Normally, you would call this sub.
Function FirstSelectedItem() As Integer
Function NextSelectedItem() As Integer
Sub SetColumnCount(Count As Integer)
Sub SetCurrentItem(Id As Integer)
Sub SetCurrentItem(Id As Integer, Column As Integer)
Sub SetHeaderLabel(Caption As String)
Sub SetHeaderLabel(Caption As String, Column As Integer)
Function SortColumn() As Integer
Sub SortItems(Column As Integer, Descending As Boolean)
Sub RemoveTopLevelItem(Index As Integer)
Function TopLevelItem(Index As Integer) As Integer
Function TopLevelItemCount() As Integer
Function IsColumnHidden(Column As Integer) As Boolean
Sub SetColumnHidden(Column As Integer, IsColumnHidden As Boolean)
Function IsSortingEnabled() As Boolean
Sub SetSortingEnabled(IsSortingEnabled As Boolean)
Function IsItemsExpandable() As Boolean
Sub SetItemsExpandable(IsItemsExpandable As Boolean)
Function IsAllColumnsShowFocus() As Boolean
Sub SetAllColumnsShowFocus(IsAllColumnsShowFocus As Boolean)
Function ColumnWidth(Column As Integer) As Integer
Sub SetColumnWidth(Column As Integer, Width As Integer)
Sub CollapseAll()
Sub ExpandAll()
Sub SelectAll()
Sub ShowColumn(Column As Integer)
Sub CollapseItem(Id As Integer)
Sub ExpandItem(Id As Integer)
Sub ScrollToItem(Id As Integer)
Sub ScrollToBottom()
Sub ScrollToTop()
Function Append(String) As Integer
Function Append(Icon As String, Caption As String) As Integer
Function ColumnCount() As Integer
Sub ColumnCount(Id As Integer, Column As Integer)
Property SelectionMode As String (ReadWrite)
Property RootIsDecorated As Boolean (ReadWrite)
Implemented since KBasic V1.74.
Property AlternatingRowColors As Boolean (ReadWrite)
Property Flat As Boolean (ReadWrite)
If it is true, appears as flat control. This is only useful to change the visual appearance.
Sub OnEvent()
This event is raised, whenever the user changes the selection.
Sub OnCurrentItemChanged(IdCurrent As Integer, IdPrevious As Integer)
Sub OnItemActivated(Id As Integer, Column As Integer)
Sub OnItemChanged(Id As Integer, Column As Integer)
Sub OnItemClicked(Id As Integer, Column As Integer)
Sub OnItemCollapsed(Id As Integer)
Sub OnItemDoubleClicked(Id As Integer, Column As Integer)
Sub OnItemEntered(Id As Integer, Column As Integer)
Sub OnItemExpanded(Id As Integer)
Sub OnItemPressed(Id As Integer, Column As Integer)
Sub OnItemSelectionChanged()
Sub OnHeaderColumnClicked(LocigalColumnIndex As Integer)
Implemented since KBasic V1.89(g).
Sub OnHeaderColumnDoubleClicked(LocigalColumnIndex As Integer)
Implemented since KBasic V1.89(g).