Exemplo n.º 1
0
 def sizeHint(self, option, index):
     st = QStaticText(index.data(RENDER_ROLE))
     st.prepare(font=self.parent().font())
     width = max(option.rect.width(), self.parent().width() - 50)
     if width and width != st.textWidth():
         st.setTextWidth(width)
     br = st.size()
     return QSize(br.width(), br.height() + self.MARGIN)
Exemplo n.º 2
0
 def sizeHint(self, option, index):
     st = QStaticText(index.data(RENDER_ROLE))
     st.prepare(font=self.parent().font())
     width = max(option.rect.width(), self.parent().width() - 50)
     if width and width != st.textWidth():
         st.setTextWidth(width)
     br = st.size()
     return QSize(br.width() + self.MARGIN, br.height() + self.MARGIN)