Change the spacing between the close button and the border
-
How to increase the spacing between the close button and the border of the tab?

I'm using this example: https://gist.github.com/espdev/4f1565b18497a42d317cdf2531b7ef05
But the close button is too close to the border of the tab for what I want to do, so I was wondering if it's possible to increase the spacing.
-
How to increase the spacing between the close button and the border of the tab?

I'm using this example: https://gist.github.com/espdev/4f1565b18497a42d317cdf2531b7ef05
But the close button is too close to the border of the tab for what I want to do, so I was wondering if it's possible to increase the spacing.
-
@Mr-Gisa said in Change the spacing between the close button and the border:
Anyone to help me with that?
This is apparently caused by the
QTabBar::tab:topsection of the stylesheet, which is really the only one relevant to your example: apparently,tab:right(and all the other orientations) does nothing because therightin there seems to refer to the tab location (at the top/bottom/left/right of the widget; in Qt Creator these are referred toNorth/South/West/Eastin thetabPositionproperty).If you remove the
QTabBar::tab:topsection altogether you get the original layout:
The
QTabBar::tab:topsection as defined in the example css file, gives the small spacing you are unsatisfied with.This can be reproduced by the following minimal stylesheet:
QString style = "\ QTabBar::tab:top {\ margin-right: -1px;\ padding: 5px 10px 5px 10px;\ }\ "; ui->tabWidget->setTabsClosable(true); ui->tabWidget->setStyleSheet(style);The result is:

If instead, I use:
QString style = "\ QTabBar::tab:top {\ margin-right: -10px;\ margin-left: 10px;\ padding: 5px 20px 5px 20px;\ }\ QTabBar::tab:top:first {\ margin-left: 0px;\ }\ ";The result is like:

So, playing with the settings in
QTabBar::tab:topin addition to overriding certain of those settings forQTabBar::tab:top:firstand/orQTabBar::tab:top:last(the first and last tabs), you can change the layout somewhat.