Hey all,

Im using QTreeWidget and a QList to display some create items from user-input text.

code below:
Qt Code:
  1. QList<QTreeWidgetItem *> items;
  2.  
  3. items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(QString(repoText))));//repoText = user-input text
  4. repoList->insertTopLevelItems(0, items); //repoList= my QTreeWidget
To copy to clipboard, switch view to plain text mode 

now i have a remove button that when the user clicks it i want it to remove the currently selected item.

using the following code, items from the QTreeWidget are removed but not the one ive clicked! ("!?!WTF...)
Qt Code:
  1. int x = items.indexOf(repoList->currentItem());
  2. repoList->takeTopLevelItem(x);
To copy to clipboard, switch view to plain text mode 

Ive also tried the following with no luck:
Qt Code:
  1. //with the following 2, the program compiles fine but nothing happens when i choose an item and click the remove button.
  2. repoList->selectedItems().removeAt(x);
  3. repoList->currentItem()->takeChild(x);
  4.  
  5. //i get a bunch of errors using the following one...
  6. repoList->selectedItems().removeAll(repoList->currentItem()->text(0));
To copy to clipboard, switch view to plain text mode 

anyways, thank you for your time, and please help :_)