Logo Search packages:      
Sourcecode: kdbg version File versions

bool KTreeView::insertItem ( const char *  text,
const QPixmap &  pixmap,
int  row = -1,
bool  prefix = true 

Inserts an item into the tree with the given text and pixmap either before or after the item at the given row. The new item is added to the same branch as the referenced item (that is, the new item will be sibling of the reference item). If row is -1, the item is simply appended to the tree at the topmost level. A KTreeViewItem is created for which the delete-children flag is set to true.

text specifies text for the new item; must not be 0
pixmap specifies a pixmap for the new item
index specifies the insert position
prefix if true, the new item is inserted before the reference item, otherwise after it
true if the item has been successfully inserted in the tree, otherwise false.

Definition at line 837 of file ktreeview.cpp.

References itemAt(), and KTreeViewItem::setDeleteChildren().

Referenced by insertItem().

    KTreeViewItem* refItem = itemAt(row);

    KTreeViewItem* item = new KTreeViewItem(theText, thePixmap);

    bool success = insertItem(refItem, item, prefix);
    if (!success)
      delete item;
    return success;

Generated by  Doxygen 1.6.0   Back to index