mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More stupid PyQt enums
This commit is contained in:
parent
c2d8be261a
commit
6b16decfe1
@ -43,7 +43,7 @@ class UpdateEditorGeometry(object):
|
|||||||
opt.showDecorationSelected = True
|
opt.showDecorationSelected = True
|
||||||
opt.decorationSize = QSize(0, 0) # We want the editor to cover the decoration
|
opt.decorationSize = QSize(0, 0) # We want the editor to cover the decoration
|
||||||
style = QApplication.style()
|
style = QApplication.style()
|
||||||
initial_geometry = style.subElementRect(style.SE_ItemViewItemText, opt, None)
|
initial_geometry = style.subElementRect(QStyle.SubElement.SE_ItemViewItemText, opt, None)
|
||||||
orig_width = initial_geometry.width()
|
orig_width = initial_geometry.width()
|
||||||
|
|
||||||
# Compute the required width: the width that can show all of the current value
|
# Compute the required width: the width that can show all of the current value
|
||||||
|
@ -43,7 +43,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
rating = item.average_rating
|
rating = item.average_rating
|
||||||
if rating is None:
|
if rating is None:
|
||||||
return
|
return
|
||||||
r = style.subElementRect(style.SE_ItemViewItemDecoration, option, widget)
|
r = style.subElementRect(QStyle.SubElement.SE_ItemViewItemDecoration, option, widget)
|
||||||
icon = option.icon
|
icon = option.icon
|
||||||
painter.save()
|
painter.save()
|
||||||
nr = r.adjusted(0, 0, 0, 0)
|
nr = r.adjusted(0, 0, 0, 0)
|
||||||
@ -59,7 +59,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
painter.restore()
|
painter.restore()
|
||||||
|
|
||||||
def draw_icon(self, style, painter, option, widget):
|
def draw_icon(self, style, painter, option, widget):
|
||||||
r = style.subElementRect(style.SE_ItemViewItemDecoration, option, widget)
|
r = style.subElementRect(QStyle.SubElement.SE_ItemViewItemDecoration, option, widget)
|
||||||
icon = option.icon
|
icon = option.icon
|
||||||
icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On)
|
icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On)
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
painter.restore()
|
painter.restore()
|
||||||
|
|
||||||
def draw_text(self, style, painter, option, widget, index, item):
|
def draw_text(self, style, painter, option, widget, index, item):
|
||||||
tr = style.subElementRect(style.SE_ItemViewItemText, option, widget)
|
tr = style.subElementRect(QStyle.SubElement.SE_ItemViewItemText, option, widget)
|
||||||
text = index.data(Qt.ItemDataRole.DisplayRole)
|
text = index.data(Qt.ItemDataRole.DisplayRole)
|
||||||
hover = option.state & style.State_MouseOver
|
hover = option.state & style.State_MouseOver
|
||||||
is_search = (True if item.type == TagTreeItem.TAG and
|
is_search = (True if item.type == TagTreeItem.TAG and
|
||||||
@ -119,7 +119,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
self.draw_text(style, painter, option, widget, index, item)
|
self.draw_text(style, painter, option, widget, index, item)
|
||||||
painter.restore()
|
painter.restore()
|
||||||
if item.boxed:
|
if item.boxed:
|
||||||
r = style.subElementRect(style.SE_ItemViewItemFocusRect, option,
|
r = style.subElementRect(QStyle.SubElement.SE_ItemViewItemFocusRect, option,
|
||||||
widget)
|
widget)
|
||||||
painter.drawLine(r.bottomLeft(), r.bottomRight())
|
painter.drawLine(r.bottomLeft(), r.bottomRight())
|
||||||
if item.type == TagTreeItem.TAG and item.tag.state == 0 and config['show_avg_rating']:
|
if item.type == TagTreeItem.TAG and item.tag.state == 0 and config['show_avg_rating']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user