Zciurus
Zciurus

Reputation: 838

How can I disable changing tabs in a QTabWidget?

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.

Upvotes: 2

Views: 1616

Answers (1)

Zciurus
Zciurus

Reputation: 838

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);

Upvotes: 4

Related Questions