moninj: elide long widget titles

This commit is contained in:
Simon Renblad 2024-07-05 15:34:52 +08:00
parent 26b5618a2f
commit 3df13eb1c6

View File

@ -40,8 +40,12 @@ class _MoninjWidget(QtWidgets.QFrame):
self.grid.setHorizontalSpacing(0)
self.grid.setVerticalSpacing(0)
self.setLayout(self.grid)
tooltip = title
if len(title) > 20:
title = title[:11] + "..." + title[-6:]
label = QtWidgets.QLabel(title)
label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
label.setToolTip(tooltip)
self.grid.addWidget(label, 1, 1)