我有一些代码可以检测到哪个选项卡被选中 QListWidget
int currentTab=ui->tabWidget->currentIndex();
if (currentTab==0)
{
// Code here
}
else if (currentTab==1)
{
// Code here
}
else if (currentTab==2)
{
// code here
}
else if (currentTab==3)
{
// code here
}
Run Code Online (Sandbox Code Playgroud)
如何使用枚举代替if(currentTab==0)或if(currentTab==1)或if(currentTab==2)或if(currentTab==3)