(self, title, bars)
| 65 | layout.addWidget(self.titleLabel) |
| 66 | |
| 67 | def updateUi(self, title, bars): |
| 68 | self.titleLabel.setText(title) |
| 69 | for bar, value in bars: |
| 70 | if bar not in self.Cache: |
| 71 | item = ToolTipItem( |
| 72 | bar.color(), |
| 73 | (bar.label() or "-") + ":" + str(value), self) |
| 74 | self.layout().addWidget(item) |
| 75 | self.Cache[bar] = item |
| 76 | else: |
| 77 | self.Cache[bar].setText( |
| 78 | (bar.label() or "-") + ":" + str(value)) |
| 79 | brush = bar.brush() |
| 80 | color = brush.color() |
| 81 | self.Cache[bar].setVisible(color.alphaF() == 1.0) # 隐藏那些不可用的项 |
| 82 | self.adjustSize() # 调整大小 |
| 83 | |
| 84 | |
| 85 | class GraphicsProxyWidget(QGraphicsProxyWidget): |
no test coverage detected