Refactor CompletionItemDelegate a bit
This commit is contained in:
parent
8dcdae00b9
commit
06ad500964
@ -237,6 +237,12 @@ class CompletionItemDelegate(QStyledItemDelegate):
|
|||||||
self.painter.drawRect(text_rect_.adjusted(0, 0, -1, -1))
|
self.painter.drawRect(text_rect_.adjusted(0, 0, -1, -1))
|
||||||
|
|
||||||
self.painter.translate(text_rect.left(), text_rect.top())
|
self.painter.translate(text_rect.left(), text_rect.top())
|
||||||
|
self._draw_textdoc(index, text_rect)
|
||||||
|
self.painter.restore()
|
||||||
|
|
||||||
|
def _draw_textdoc(self, index, text_rect):
|
||||||
|
# FIXME we probably should do eliding here. See
|
||||||
|
# qcommonstyle.cpp:viewItemDrawText
|
||||||
clip = QRectF(0, 0, text_rect.width(), text_rect.height())
|
clip = QRectF(0, 0, text_rect.width(), text_rect.height())
|
||||||
|
|
||||||
text_option = QTextOption()
|
text_option = QTextOption()
|
||||||
@ -274,11 +280,6 @@ class CompletionItemDelegate(QStyledItemDelegate):
|
|||||||
html.escape(txt)))
|
html.escape(txt)))
|
||||||
doc.drawContents(self.painter, clip)
|
doc.drawContents(self.painter, clip)
|
||||||
|
|
||||||
# FIXME we probably should do eliding here. See
|
|
||||||
# qcommonstyle.cpp:viewItemDrawText
|
|
||||||
|
|
||||||
self.painter.restore()
|
|
||||||
|
|
||||||
def _draw_focus_rect(self):
|
def _draw_focus_rect(self):
|
||||||
state = self.opt.state
|
state = self.opt.state
|
||||||
if not state & QStyle.State_HasFocus:
|
if not state & QStyle.State_HasFocus:
|
||||||
|
Loading…
Reference in New Issue
Block a user