mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 22:43:31 +02:00
Yet another fix for book list header rendering
The row numbers were being elided on one users computer. Probably because I forgot to set the correct font metrics on the option object in the paint method. In any cases we dont actually want elision for headers.
This commit is contained in:
parent
a978adf02b
commit
58032f0f89
1 changed files with 7 additions and 2 deletions
|
|
@ -72,11 +72,16 @@ def paintSection(self, painter, rect, logical_index):
|
|||
opt.section = logical_index
|
||||
opt.orientation = self.orientation()
|
||||
opt.textAlignment = Qt.AlignHCenter | Qt.AlignVCenter
|
||||
opt.fontMetrics = self.fm
|
||||
model = self.parent().model()
|
||||
opt.text = unicode(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '')
|
||||
style = self.style()
|
||||
margin = 2 * style.pixelMetric(style.PM_HeaderMargin, None, self)
|
||||
if self.isSortIndicatorShown() and self.sortIndicatorSection() == logical_index:
|
||||
opt.sortIndicator = QStyleOptionHeader.SortDown if self.sortIndicatorOrder() == Qt.AscendingOrder else QStyleOptionHeader.SortUp
|
||||
opt.text = opt.fontMetrics.elidedText(opt.text, Qt.ElideRight, rect.width() - 4)
|
||||
margin += style.pixelMetric(style.PM_HeaderMarkSize, None, self)
|
||||
opt.text = unicode(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '')
|
||||
if self.textElideMode() != Qt.ElideNone:
|
||||
opt.text = opt.fontMetrics.elidedText(opt.text, Qt.ElideRight, rect.width() - margin)
|
||||
if self.isEnabled():
|
||||
opt.state |= QStyle.State_Enabled
|
||||
if self.window().isActiveWindow():
|
||||
|
|
|
|||
Loading…
Reference in a new issue