I have a QTabWidget with a background gradient and two problems.
-
How dow I remove the anoying outline around the active tab (see image)? I tried “outline: none” like with push buttons but it does not seem to have an effect.
-
How do I style disabled tabs? I tried :disabled and :!enabled but both do not work. // Edit: This works with :disabled but not with all properties. Seems like I tried the only not supported.

The qt documentation was no help. Google either. 🙁
It seems that the focus rectangle is handled by the
QStyle(not to be confused with style sheets) that is in use. You can write aQStylesubclass and apply that to your to yourQTabWidget. The subclass should override thedrawControl()method and do nothing if it is currently drawing the focus rectangle.The subclass would look something like this:
NoFocusRectStyle.h
NoFocusRectStyle.cpp
Somewhere in your form’s intializer/constructor you would apply the custom style subclass to the tab widget:
This should allow your style sheets to continue to work.
It would be nice if there was an easier way to do this but I couldn’t find one 🙂