| 87 | |
| 88 | |
| 89 | class ToolTipWidget(QWidget): |
| 90 | Cache = {} |
| 91 | |
| 92 | def __init__(self, *args, **kwargs): |
| 93 | super(ToolTipWidget, self).__init__(*args, **kwargs) |
| 94 | self.setAttribute(Qt.WA_StyledBackground, True) |
| 95 | self.setStyleSheet( |
| 96 | "ToolTipWidget{background: rgba(50,50,50,70);}") |
| 97 | layout = QVBoxLayout(self) |
| 98 | self.titleLabel = QLabel(self, styleSheet="color:white;") |
| 99 | layout.addWidget(self.titleLabel) |
| 100 | |
| 101 | def updateUi(self, title, points): |
| 102 | self.titleLabel.setText(title) |
| 103 | for serie, point in points: |
| 104 | if serie not in self.Cache: |
| 105 | item = ToolTipItem( |
| 106 | serie.color(), |
| 107 | (serie.name() or "-") + ":" + str(point.y()), self) |
| 108 | self.layout().addWidget(item) |
| 109 | self.Cache[serie] = item |
| 110 | else: |
| 111 | self.Cache[serie].setText( |
| 112 | (serie.name() or "-") + ":" + str(point.y())) |
| 113 | |
| 114 | |
| 115 | class GraphicsProxyWidget(QGraphicsProxyWidget): |