Fix some tabs in preferences not having margins

This commit is contained in:
Kovid Goyal 2020-06-14 10:08:22 +05:30
parent 5e68de686b
commit 36dac43b93
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 7 deletions

View File

@ -300,7 +300,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="cover_grid_tab">
<widget class="QTabWidget" name="cover_grid_tab">
<attribute name="icon">
<iconset resource="../../../../resources/images.qrc">
<normaloff>:/images/grid.png</normaloff>:/images/grid.png</iconset>
@ -308,9 +308,6 @@
<attribute name="title">
<string>Cover &amp;grid</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget_2">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
@ -714,9 +711,6 @@ A value of zero means calculate automatically.</string>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="book_details_tab">
<attribute name="icon">

View File

@ -509,6 +509,13 @@ class ScrollingTabWidget(QTabWidget):
def wrap_widget(self, page):
sw = QScrollArea(self)
pl = page.layout()
if pl is not None:
cm = pl.contentsMargins()
# For some reasons designer insists on setting zero margins for
# widgets added to a tab widget, which looks horrible.
if (cm.left(), cm.top(), cm.right(), cm.bottom()) == (0, 0, 0, 0):
pl.setContentsMargins(9, 9, 9, 9)
name = 'STW{}'.format(abs(id(self)))
sw.setObjectName(name)
sw.setWidget(page)