0
votes

if anyone has a good example of how can I identify that the user have chosen a tab in a window using QT provide it to me. I searched on line and the provided code give me error .. so here what I am trying to do :

I have a main window which has 3 tabs I will mainly show the same video on all of them but in each will run different algorithm, so I don't want them to run all the time because it will consume lots of processing from my cpu, so I would like to only make it work when the user select or open the tab .. here what I tried :

QObject::connect(ui->tabWidget, SIGNAL(ui->tabWidget->currentChanged(int idx)), ui->label, SLOT(setNum(int idx)));

and it gives me this error

Object::connect: No such signal QTabWidget::ui->tabWidget->currentChanged(int idx)
1
your title has nothing to do with the actual issue. - UmNyobe
I want to identify which tab was selected.. using Qt-tab widget .. what do you want me to call it! - user573014

1 Answers

2
votes

When you write a connect statement, do not include variable names or parameter names in the SIGNAL or SLOT macros. i.e., you should write this:

QObject::connect(ui->tabWidget, SIGNAL(currentChanged(int)), ui->label, SLOT(setNum(int)));