0
votes

I have an application which uses a QTreeWidget next to a QTabWidget. On the frame that contains the two and the QTreeWidget I can set the properties:

frameShape : NoFrame --and-- frameShadow : Plain

This gives a nice flat look. But the QTabWidget does not have these properties and it has a shadow and is raised.

How do I get the QTabWidget to look flat?

Picture is attached. Picture of Application

1
How tabs look depends on the GUI theme. Tabs already come flat by default on my system. Maybe you want to use a Stacked Widget container instead and put buttons on top for tab activation? In general I would try avoid mingling with these things, as usability is typically improved by staying consistent with the system look&feel.ypnos
I really need to use the QTabWidget; I actually hide the tab bar anyway, but the whole container is still raised.. How do I change the GUI theme?user846566
A tab widget without tab bar and without borders is exactly what QStackedWidget is?!ypnos

1 Answers

0
votes

You can use stylesheet to customize the look of the border.
Using stylesheet often resets some of the default/native style like the background so you will need to define it explicitely depending on your needs.

QTabWidget::pane { border: none; } // No border at all
QTabWidget::pane { border: 1px solid black; } // Simple black border

See the examples.


Based on your question and screenshot, your QTreeWidget is not actually flat, it has an inset style, while the QTabWidget has an outset. It's not very clear what you want to achieve exactly. But I fully agree with @ypnos in the comments, you seem to need a QStackWidget and not a QTabWidget.

I also think you should probably keep the native style, which will change depending on the OS and the user preferences. If you want to customize the look and feel of your application you generally need to customize all of it and make something consistent, not just a widget that does not please you.