From 354c07d0279c79a8490c80897838a072eeed0d9f Mon Sep 17 00:00:00 2001 From: Ivan Titov Date: Fri, 26 Mar 2021 19:00:38 +0500 Subject: [PATCH] Operator Manager #22 --- .../houdini_tdk/operator_manager/delegate.py | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/python2.7libs/houdini_tdk/operator_manager/delegate.py b/python2.7libs/houdini_tdk/operator_manager/delegate.py index 70b3aa0..bbce778 100644 --- a/python2.7libs/houdini_tdk/operator_manager/delegate.py +++ b/python2.7libs/houdini_tdk/operator_manager/delegate.py @@ -43,35 +43,26 @@ def paint(self, painter, option, index): row_rect.setRight(option.widget.width()) icon_rect = QRectF(option.rect) - icon_rect.setLeft(0) icon_rect.setRight(45) text_rect = QRectF(row_rect) text_rect.setRight(row_rect.right() - 30) - additional_selection_rect = QRectF(row_rect) - additional_selection_rect.setLeft(option.rect.right() + 1) + selection_rect = QRectF(row_rect) + selection_rect.setLeft(icon_rect.right()) painter.save() - painter.setClipping(True) - painter.setClipRect(icon_rect) + option.rect = icon_rect.toRect() super(OperatorManagerLibraryDelegate, self).paint(painter, option, index) painter.restore() if option.state & QStyle.State_Selected and index.column() == 0: - painter.fillRect(additional_selection_rect, option.palette.highlight()) + painter.fillRect(selection_rect, option.palette.highlight()) metrics = painter.fontMetrics() - text = metrics.elidedText(index.data(TextRole), Qt.ElideMiddle, text_rect.width(), Qt.TextSingleLine) + text = metrics.elidedText(index.data(TextRole), Qt.ElideMiddle, text_rect.width()) - text_image = QImage(text_rect.size().toSize(), QImage.Format_ARGB32_Premultiplied) - text_image.fill(Qt.transparent) - p = QPainter(text_image) - p.setPen(option.palette.text().color()) - p.drawText(0, 0, text_rect.width(), text_rect.height(), Qt.AlignVCenter | Qt.AlignLeft, text) - p.end() - - painter.drawImage(text_rect.topLeft(), text_image) + painter.drawText(text_rect, Qt.AlignVCenter | Qt.AlignLeft, text) painter.restore() else: