1
votes

I have a QTabWidget with multiple tabs. I want to disble the tabwidget itself so that the user cannot change the current tab, but the contents of the current tab have to stay enabled. How can I achive this in Qt?

If I disable the entire QTabWidget, the contents of the current tab will get disabled as well, which I don't want.

I also tried to disable all but the current tab, but this only disables the other tabs' contents. The other tabs themselves can still be opened.

1
You might try to override the QTabWidget::changeEvent() function and ignore events?vahancho
thanks for the answer, but I found a solution myself after looking into the docs of QTabWidget and how it worksZciurus-Alt-Del

1 Answers

3
votes

I did some more research and found a solution, what I want is to disable the tabBar of my QTabWidget, like this:

ui->mytabWidget->tabBar()->setEnabled(false);