'Override QLabel::paintEvent to draw elided text.'

def paintEvent(self, e):

    if (self._elidemode == Qt.ElideNone):
        super().paintEvent(e)
    else:
        e.accept()
        painter = QPainter(self)
        geom = self.geometry()
        qtutils.ensure_valid(geom)
        painter.drawText(0, 0, geom.width(), geom.height(), self.alignment(), self._elided_text)
