Refactor CompletionItemDelegate a bit

This commit is contained in:
Florian Bruhin 2014-01-29 06:36:13 +01:00
parent 8dcdae00b9
commit 06ad500964

View File

@ -237,6 +237,12 @@ class CompletionItemDelegate(QStyledItemDelegate):
self.painter.drawRect(text_rect_.adjusted(0, 0, -1, -1))
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())
text_option = QTextOption()
@ -274,11 +280,6 @@ class CompletionItemDelegate(QStyledItemDelegate):
html.escape(txt)))
doc.drawContents(self.painter, clip)
# FIXME we probably should do eliding here. See
# qcommonstyle.cpp:viewItemDrawText
self.painter.restore()
def _draw_focus_rect(self):
state = self.opt.state
if not state & QStyle.State_HasFocus: