Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove the "padding" of a QTabWidget?

Tags:

I have a QTabWidget with a QTableWidget inside, as the example below:

enter image description here

But it has a "padding" (at least I think it is a padding) in the QTabWidget (marked as red in the figure).

How can I remove that or expand the QTableWidget to fill the QTabWidget area?

I am using Qt 5.3.

like image 683
KelvinS Avatar asked Feb 15 '17 16:02

KelvinS


2 Answers

Try something like this :

tabwidget.setStyleSheet("QTabWidget::pane { 
 margin: 0px,1px,1px,1px;
 border: 2px solid #020202;
 border-radius: 7px;
 padding: 1px;
 background-color: #E6E6E3;
}");

Hope this help you

like image 185
lntl Avatar answered Sep 23 '22 10:09

lntl


The problem seems to be related to the "pane" margin of the QTabWidget.

I solved the problem by using this on the stylesheet:

QTabWidget::pane {
    border: 0 solid white;
    margin: -13px -9px -13px -9px;
}
like image 43
KelvinS Avatar answered Sep 23 '22 10:09

KelvinS