forked from M-Labs/artiq
1
0
Fork 0

moninj: elide long widget titles

This commit is contained in:
Simon Renblad 2024-07-05 15:34:52 +08:00
parent 26b5618a2f
commit 3df13eb1c6
1 changed files with 4 additions and 0 deletions

View File

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