I have a problem with QTabBar / QTabWidget. This is what my program currently looks like using QTabBar:
As you can see, there is an ugly line between QTabBar and QScrollArea. This line is part of the QScrollArea framework, which I cannot just get rid of, because it is required on three sides. I understand that I can use QTabWidget, but then I will need to create a widget for each tab, which is not possible here: the contents of QScrollArea change according to the selected tab, but there is only one QScrollArea widget. (Duplicating it every time a new tab is created will cause its own problems.)
So does anyone know a way: (i) tell QScrollArea to draw a frame without the top line; or
(ii) use the same widget for each tab in a QTabWidget?
Update 3 . For a different approach, see my answer below.
Update 1 I implemented the zvezdi suggestion and the ugly line disappeared:
This is an improvement. But this is not so. Look at the gaps between the scrollbars and the border. On the right, two pixels instead of one; at the bottom are three pixels. And the space on the right between the QScrollArea border and the mainWidget border is one pixel too large. This is due to the QTabWidget border style that I am losing due to my sanity trying to change. If I say:
MyTabWidget -> setStyleSheet ("QTabWidget::pane { margin: 0px,0px,0px,0px }") ;
then the fields seem correct, but the borders disappear:
If I say:
MyTabWidget -> setStyleSheet ("QTabWidget::pane { " " margin: 0px,0px,0px,0px;" " border: 1px solid darkgray;" "}") ;
then I almost returned to where I started:
If I try to fix this, follow these steps:
ApplicationTabWidget -> setStyleSheet ("QTabWidget::pane { " " margin: 0px,0px,0px,0px;" " border: 1px solid darkgray;" " border-top: 0px;" "}") ;
then again I mock my pain:
Update 2 If I forget setStyleSheet
and just turn it on documentMode
, this is what I get:
Please someone, tell me that I am stupid and there is a completely simple solution for all this.