openshot-audio
0.1.2
|
|
inline |
|
inlineoverridevirtual |
Creates a component that will be used to represent this item.
You don't have to implement this method - if it returns nullptr then no component will be used for the item, and you can just draw it using the paintItem() callback. But if you do return a component, it will be positioned in the treeview so that it can be used to represent this item.
The component returned will be managed by the treeview, so always return a new component, and don't keep a reference to it, as the treeview will delete it later when it goes off the screen or is no longer needed. Also bear in mind that if the component keeps a reference to the item that created it, that item could be deleted before the component. Its position and size will be completely managed by the tree, so don't attempt to move it around.
Something you may want to do with your component is to give it a pointer to the TreeView that created it. This is perfectly safe, and there's no danger of it becoming a dangling pointer because the TreeView will always delete the component before it is itself deleted.
As long as you stick to these rules you can return whatever kind of component you like. It's most useful if you're doing things like drag-and-drop of items, or want to use a Label component to edit item names, etc.
Reimplemented from TreeViewItem.
|
inlineoverridevirtual |
Must return the height required by this item.
This is the height in pixels that the item will take up. Items in the tree can be different heights, but if they change height, you should call treeHasChanged() to update the tree.
Reimplemented from TreeViewItem.
|
inlineoverridevirtual |
Returns a string to uniquely identify this item.
If you're planning on using the TreeView::getOpennessState() method, then these strings will be used to identify which nodes are open. The string should be unique amongst the item's sibling items, but it's ok for there to be duplicates at other levels of the tree.
If you're not going to store the state, then it's ok not to bother implementing this method.
Reimplemented from TreeViewItem.
|
inlineoverridevirtual |
Tells the tree whether this item can potentially be opened.
If your item could contain sub-items, this should return true; if it returns false then the tree will not try to open the item. This determines whether or not the item will be drawn with a 'plus' button next to it.
Implements TreeViewItem.