User Tools

Site Tools


2treeview

2TreeView (QTreeWidget)

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 Len(). 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.

TODO

for performance reasons alls methods with column also available as Sub SetCaption(Id As Integer, CaptionColumn1 As String, …, CaptionColumn16 As String) SetHeaderLabel, SetColumnWidth, SetIcon…

METHODS

AppendChild

Function AppendChild(Caption As String) As Integer


AppendChild

Function AppendChild(Icon As String, Caption As String) As Integer


AppendChild

Function AppendChild(Id As Integer, Caption As String) As Integer


AppendChild

Function AppendChild(Id As Integer, Icon As String, Caption As String) As Integer


ChildCount

Function ChildCount(Id As Integer) As Integer


Child

Function Child(Id As Integer, Index As Integer) As Integer


Tag

Function Tag(Id As Integer, Column As Integer) As String


SetTag

Sub SetTag(Id As Integer, Column As Integer, Tag As String)


CheckState

Function CheckState(Id As Integer, Column As Integer) As String


SetCheckState

Sub SetCheckState(Id As Integer, Column As Integer, CheckState As String)


Data

Function Data(Id As Integer) As Integer

Sorry. Not implemented yet.


Flag

Function Flag(Id As Integer) As String


SetFlag

Sub SetFlag(Id As Integer, Flag As String)

FlagQt documentation says
ItemIsSelectableIt can be selected.
ItemIsEditableIt can be edited.
ItemIsDragEnabledIt can be dragged.
ItemIsDropEnabledIt can be used as a drop target.
ItemIsUserCheckableIt can be checked or unchecked by the user.
ItemIsEnabledThe user can interact with the item.
ItemIsTristateThe item is checkable with three separate states.

SetBackground

Sub SetBackground(Id As Integer, Column As Integer, ColorId As String)


SetBackground

Sub SetBackground(Id As Integer, Column As Integer, ColorId As String, BrushStyle As String)


SetFontColor

Sub SetFontColor(Id As Integer, Column As Integer, ColorId As String)


SetFontColor

Sub SetFontColor(Id As Integer, Column As Integer, ColorId As String, BrushStyle As String)


SetFont

Sub SetFont(Id As Integer, Column As Integer, FontId As String)


Caption

Function Caption(Id As Integer, Column As Integer) As String


SetCaption

Sub SetCaption(Id As Integer, Column As Integer, Caption As String)


SetIcon

Sub SetIcon(Id As Integer, Column As Integer, Icon As String)


IndexOfChild

Function IndexOfChild(Id As Integer, ChildId As Integer) As Integer


InsertChild

Function InsertChild(Id As Integer, Index As Integer, Caption As String) As Integer


InsertChild

Function InsertChild(Id As Integer, Index As Integer, Icon As String, Caption As String) As Integer


IsExpanded

Function IsExpanded(Id As Integer) As Boolean


SetExpanded

Sub SetExpanded(Id As Integer, IsExpanded As Boolean)


IsHidden

Function IsHidden(Id As Integer) As Boolean


SetHidden

Sub SetHidden(Id As Integer, IsHidden As Boolean)


IsSelected

Function IsSelected(Id As Integer) As Boolean


SetSelected

Sub SetSelected(Id As Integer, IsSelected As Boolean)

Please read SetFlag as well.


StatusTip

Function StatusTip(Id As Integer, Column As Integer) As String


SetStatusTip

Sub SetStatusTip(Id As Integer, Column As Integer, StatusTip As String)


ToolTip

Function ToolTip(Id As Integer, Column As Integer) As String


SetToolTip

Sub SetToolTip(Id As Integer, Column As Integer, ToolTip As String)


RemoveChild

Sub RemoveChild(Id As Integer, Index As Integer)


TextAlignment

Function TextAlignment(Id As Integer, Column As Integer) As String


SetTextAlignment

Sub SetTextAlignment(Id As Integer, Column As Integer, TextAlignment As String)

Possible ValueDescription (Qt documentation says)
AlignLeftAligns with the left edge.
AlignRightAligns with the right edge.
AlignHCenterCenters horizontally in the available space.
AlignJustifyJustifies the text in the available space.
AlignTopAligns with the top.
AlignBottomAligns with the bottom.
AlignVCenterCenters vertically in the available space.
AlignCenterCenters in both dimensions.
AlignAbsoluteIf 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.
AlignLeadingSynonym for AlignLeft.
AlignTrailingSynonym for AlignRight.
AlignHorizontal_MaskAlignLeft Or AlignRight Or AlignHCenter Or AlignJustify Or AlignAbsolute
AlignVertical_MaskAlignTop Or AlignBottom Or AlignVCenter

ColumnCount

Function ColumnCount(Id As Integer) As Integer


Append

Function Append(Caption As String) As Integer


Append

Function Append(Icon As String, Caption As String) As Integer


ClosePersistentEditor

Sub ClosePersistentEditor(Id As Integer, Column As Integer)

Normally, you would call this sub.


ColumnCount

Function ColumnCount() As Integer


CurrentColumn

Function CurrentColumn() As Integer


CurrentItem

Function CurrentItem() As Integer


FindItem

Function FindItem(Caption As String, Flag As String, Column As Integer) As Integer

FlagQt documentation says
MatchExactlyPerforms QVariant-based matching.
MatchFixedStringPerforms string-based matching. String-based comparisons are case-insensitive unless the MatchCaseSensitive flag is also specified.
MatchContainsThe search term is contained in the item.
MatchStartsWithThe search term matches the start of the item.
MatchEndsWithThe search term matches the end of the item.
MatchCaseSensitiveThe search is case sensitive.
MatchRegExpPerforms string-based matching using a regular expression as the search term.
MatchWildcardPerforms string-based matching using a string with wildcards as the search term.
MatchWrapPerform 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.
MatchRecursiveSearches the entire hierarchy.

HeaderItem

Function HeaderItem() As Integer


IndexOfTopLevelItem

Function IndexOfTopLevelItem(Id As Integer) As Integer


Insert

Function Insert(Index As Integer, Caption As String) As Integer


Insert

Function Insert(Index As Integer, Icon As String, Caption As String) As Integer


InvisibleRootItem

Function InvisibleRootItem() As Integer


ItemAt

Function ItemAt(X As Integer, Y As Integer) As Integer

Returns the item at position X/Y.


OpenPersistentEditor

Sub OpenPersistentEditor(Id As Integer, Column As Integer)

Normally, you would call this sub.


FirstSelectedItem

Function FirstSelectedItem() As Integer


NextSelectedItem

Function NextSelectedItem() As Integer


SetColumnCount

Sub SetColumnCount(Count As Integer)


SetCurrentItem

Sub SetCurrentItem(Id As Integer)


SetCurrentItem

Sub SetCurrentItem(Id As Integer, Column As Integer)


SetHeaderLabel

Sub SetHeaderLabel(Caption As String)


SetHeaderLabel

Sub SetHeaderLabel(Caption As String, Column As Integer)


SortColumn

Function SortColumn() As Integer


SortItems

Sub SortItems(Column As Integer, Descending As Boolean)


RemoveTopLevelItem

Sub RemoveTopLevelItem(Index As Integer)


TopLevelItem

Function TopLevelItem(Index As Integer) As Integer


TopLevelItemCount

Function TopLevelItemCount() As Integer


IsColumnHidden

Function IsColumnHidden(Column As Integer) As Boolean


SetColumnHidden

Sub SetColumnHidden(Column As Integer, IsColumnHidden As Boolean)


IsSortingEnabled

Function IsSortingEnabled() As Boolean


SetSortingEnabled

Sub SetSortingEnabled(IsSortingEnabled As Boolean)


IsItemsExpandable

Function IsItemsExpandable() As Boolean


SetItemsExpandable

Sub SetItemsExpandable(IsItemsExpandable As Boolean)


IsAllColumnsShowFocus

Function IsAllColumnsShowFocus() As Boolean


SetAllColumnsShowFocus

Sub SetAllColumnsShowFocus(IsAllColumnsShowFocus As Boolean)


ColumnWidth

Function ColumnWidth(Column As Integer) As Integer


SetColumnWidth

Sub SetColumnWidth(Column As Integer, Width As Integer)


CollapseAll

Sub CollapseAll()


ExpandAll

Sub ExpandAll()


SelectAll

Sub SelectAll()


ShowColumn

Sub ShowColumn(Column As Integer)


CollapseItem

Sub CollapseItem(Id As Integer)


ExpandItem

Sub ExpandItem(Id As Integer)


ScrollToItem

Sub ScrollToItem(Id As Integer)


ScrollToBottom

Sub ScrollToBottom()


ScrollToTop

Sub ScrollToTop()


PROPERTIES

SelectionMode

Property SelectionMode As String (ReadOnly)


AlternatingRowColors

Property AlternatingRowColors As Boolean (ReadOnly)


Flat

Property Flat As Boolean (ReadOnly)

If it is true, appears as flat control. This is only useful to change the visual appearance.


EVENTS

OnEvent

Sub OnEvent()

This event is raised, whenever the user changes the selection.


OnCurrentItemChanged

Sub OnCurrentItemChanged(IdCurrent As Integer, IdPrevious As Integer)


OnItemActivated

Sub OnItemActivated(Id As Integer, Column As Integer)


OnItemChanged

Sub OnItemChanged(Id As Integer, Column As Integer)


OnItemClicked

Sub OnItemClicked(Id As Integer, Column As Integer)


OnItemCollapsed

Sub OnItemCollapsed(Id As Integer)


OnItemDoubleClicked

Sub OnItemDoubleClicked(Id As Integer, Column As Integer)


OnItemEntered

Sub OnItemEntered(Id As Integer, Column As Integer)


OnItemExpanded

Sub OnItemExpanded(Id As Integer)


OnItemPressed

Sub OnItemPressed(Id As Integer, Column As Integer)


OnItemSelectionChanged

Sub OnItemSelectionChanged()


Not implemented yet:

Custom controls in rows and columns

HideColumn

Sub HideColumn(Column As Integer)

EditItem

Sub EditItem(Id As Integer, Column As Integer)

The item must be set editable using SetFlag before this works.


ShowHeader

Sub ShowHeader()


HideHeader

Sub HideHeader()


2treeview.txt · Last modified: 2013/04/09 22:57 (external edit)