diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 7200197e44..24b0f65816 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -43,7 +43,7 @@ class UpdateEditorGeometry(object): opt.showDecorationSelected = True opt.decorationSize = QSize(0, 0) # We want the editor to cover the decoration 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() # Compute the required width: the width that can show all of the current value diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 42b601f2f8..26d84dcfbf 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -43,7 +43,7 @@ class TagDelegate(QStyledItemDelegate): # {{{ rating = item.average_rating if rating is None: return - r = style.subElementRect(style.SE_ItemViewItemDecoration, option, widget) + r = style.subElementRect(QStyle.SubElement.SE_ItemViewItemDecoration, option, widget) icon = option.icon painter.save() nr = r.adjusted(0, 0, 0, 0) @@ -59,7 +59,7 @@ class TagDelegate(QStyledItemDelegate): # {{{ painter.restore() 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.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On) @@ -75,7 +75,7 @@ class TagDelegate(QStyledItemDelegate): # {{{ painter.restore() 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) hover = option.state & style.State_MouseOver 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) painter.restore() if item.boxed: - r = style.subElementRect(style.SE_ItemViewItemFocusRect, option, + r = style.subElementRect(QStyle.SubElement.SE_ItemViewItemFocusRect, option, widget) painter.drawLine(r.bottomLeft(), r.bottomRight()) if item.type == TagTreeItem.TAG and item.tag.state == 0 and config['show_avg_rating']: