Frage

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)
War es hilfreich?

Lösung

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)));
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top