nbkhwjm
26th January 2008, 04:52
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...
connect(ui.treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(setActiveTool());
int Porcupine::setActiveTool()
{
// What goes here to determine the current index of the selected tree item?
switch (item) {
case 0:
{
ui.pageTitle->setText("case 0");
}
break;
case 1:
{
ui.pageTitle->setText("case 1");
}
break;
case 2:
{
ui.pageTitle->setText("case 2");
}
break;
}
}
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...
connect(ui.treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(setActiveTool());
int Porcupine::setActiveTool()
{
// What goes here to determine the current index of the selected tree item?
switch (item) {
case 0:
{
ui.pageTitle->setText("case 0");
}
break;
case 1:
{
ui.pageTitle->setText("case 1");
}
break;
case 2:
{
ui.pageTitle->setText("case 2");
}
break;
}
}