2

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.

Zciurus
  • 786
  • 4
  • 23
  • You might try to override the `QTabWidget::changeEvent()` function and ignore events? – vahancho Sep 18 '20 at 08:14
  • thanks for the answer, but I found a solution myself after looking into the docs of QTabWidget and how it works – Zciurus Sep 18 '20 at 08:18

1 Answers1

4

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);
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Zciurus
  • 786
  • 4
  • 23