Use the default row height for the book list, rather than resizing to contents, as the Fusion style has a nice default row height

Also allow both increasing and decreasing of the row height
This commit is contained in:
Kovid Goyal 2014-04-26 09:18:14 +05:30
parent bfd037120a
commit 7dea39ec30
4 changed files with 10 additions and 9 deletions

View File

@ -111,7 +111,7 @@ defs['bd_show_cover'] = True
defs['bd_overlay_cover_size'] = False
defs['tags_browser_category_icons'] = {}
defs['cover_browser_reflections'] = True
defs['extra_row_spacing'] = 0
defs['book_list_extra_row_spacing'] = 0
defs['refresh_book_list_on_bulk_edit'] = True
defs['cover_grid_width'] = 0
defs['cover_grid_height'] = 0

View File

@ -163,6 +163,7 @@ class BooksView(QTableView): # {{{
def __init__(self, parent, modelcls=BooksModel, use_edit_metadata_dialog=True):
QTableView.__init__(self, parent)
self.default_row_height = self.verticalHeader().defaultSectionSize()
self.gui = parent
self.setProperty('highlight_current_item', 150)
self.row_sizing_done = False
@ -658,9 +659,8 @@ class BooksView(QTableView): # {{{
def do_row_sizing(self):
# Resize all rows to have the correct height
if not self.row_sizing_done and self.model().rowCount(QModelIndex()) > 0:
self.resizeRowToContents(0)
self.verticalHeader().setDefaultSectionSize(self.rowHeight(0) +
gprefs['extra_row_spacing'])
vh = self.verticalHeader()
vh.setDefaultSectionSize(max(vh.minimumSectionSize(), self.default_row_height + gprefs['book_list_extra_row_spacing']))
self._model.set_row_height(self.rowHeight(0))
self.row_sizing_done = True

View File

@ -157,6 +157,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
r('emblem_size', gprefs)
r('emblem_position', gprefs, choices=[
(_('Left'), 'left'), (_('Top'), 'top'), (_('Right'), 'right'), (_('Bottom'), 'bottom')])
r('book_list_extra_row_spacing', gprefs)
def get_esc_lang(l):
if l == 'en':

View File

@ -207,18 +207,18 @@
<string>Extra &amp;spacing to add between rows in the book list:</string>
</property>
<property name="buddy">
<cstring>opt_extra_row_spacing</cstring>
<cstring>opt_book_list_extra_row_spacing</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="opt_extra_row_spacing">
<property name="specialValueText">
<string>None</string>
</property>
<widget class="QSpinBox" name="opt_book_list_extra_row_spacing">
<property name="suffix">
<string> px</string>
</property>
<property name="minimum">
<number>-5</number>
</property>
</widget>
</item>
</layout>