from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFontMetrics, QPainter
from PyQt5.QtWidgets import QLabel


# class ElideLabel(QLabel):
#     """
#     From https://stackoverflow.com/questions/11446478/
#     pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize
#     """
# 
#     def paintEvent(self, event):
#         painter = QPainter(self)
#         metrics = QFontMetrics(self.font())
#         elided = metrics.elidedText(self.text(), Qt.ElideRight, self.width())
# 
#         painter.drawText(self.rect(), self.alignment(), elided)
