[docs]
class Text(QLabel):
def __init__(self, text: str | None = None):
super().__init__()
if text:
self.setText(text)
self.setTextFormat(Qt.TextFormat.RichText)
self.setWordWrap(True)
self.setTextInteractionFlags(
Qt.TextInteractionFlag.LinksAccessibleByKeyboard
| Qt.TextInteractionFlag.LinksAccessibleByMouse
| Qt.TextInteractionFlag.TextSelectableByKeyboard
| Qt.TextInteractionFlag.TextSelectableByMouse
)
self.setOpenExternalLinks(True)
[docs]
class Code(Text):
def __init__(self, text: str | None = None):
super().__init__(text)
font = QFont()
self.setFont(font)
[docs]
def setText(self, a0: str | None) -> None:
super().setText(f"<pre>{a0}</pre>" if a0 else a0)