diff --git a/Orange/widgets/visualize/owsilhouetteplot.py b/Orange/widgets/visualize/owsilhouetteplot.py index 70d9414584b..5ceb828c901 100644 --- a/Orange/widgets/visualize/owsilhouetteplot.py +++ b/Orange/widgets/visualize/owsilhouetteplot.py @@ -35,6 +35,9 @@ from Orange.widgets.widget import Msg +ROW_NAMES_WIDTH = 200 + + class OWSilhouettePlot(widget.OWWidget): name = "Silhouette Plot" description = "Visually assess cluster quality and " \ @@ -507,7 +510,10 @@ def setRowNames(self, names): item = layout.itemAt(i + 1, 3) if grp.rownames is not None: - item.setItems(grp.rownames) + metrics = QFontMetrics(self.font()) + rownames = [metrics.elidedText(rowname, Qt.ElideRight, ROW_NAMES_WIDTH) + for rowname in grp.rownames] + item.setItems(rownames) item.setVisible(self.__rowNamesVisible) else: item.setItems([]) @@ -907,8 +913,7 @@ def event(self, event): return super().event(event) def sizeHint(self, which, constraint=QSizeF()): - spacing = max(self.__spacing * (self.count() - 1), 0) - return QSizeF(300, self.__barsize * self.count() + spacing) + return QSizeF(300, (self.__barsize + self.__spacing) * self.count()) def setPreferredBarSize(self, size): if self.__barsize != size: @@ -918,11 +923,6 @@ def setPreferredBarSize(self, size): def spacing(self): return self.__spacing - def setSpacing(self, spacing): - if self.__spacing != spacing: - self.__spacing = spacing - self.updateGeometry() - def setPen(self, pen): pen = QPen(pen) if self.__pen != pen: