I have a QtreeWidget build with designer with three items.

I want to execute a function when each item is selected, i can connect the signal itemclicked to a function, then what can i use to do a switch case?

Ive tried qtreewidgetitem, but no luck...

I setup the Signal/slot so that is calls a function...

Qt Code:
  1. connect(ui.treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
  2. this, SLOT(setActiveTool());
  3.  
  4.  
  5. int Porcupine::setActiveTool()
  6. {
  7.  
  8. // What goes here to determine the current index of the selected tree item?
  9.  
  10. switch (item) {
  11. case 0:
  12. {
  13. ui.pageTitle->setText("case 0");
  14. }
  15. break;
  16.  
  17. case 1:
  18. {
  19. ui.pageTitle->setText("case 1");
  20. }
  21. break;
  22.  
  23. case 2:
  24. {
  25. ui.pageTitle->setText("case 2");
  26. }
  27. break;
  28. }
  29. }
To copy to clipboard, switch view to plain text mode