| 36 | class ToolTipItem(QWidget): |
| 37 | |
| 38 | def __init__(self, color, text, parent=None): |
| 39 | super(ToolTipItem, self).__init__(parent) |
| 40 | layout = QHBoxLayout(self) |
| 41 | layout.setContentsMargins(0, 0, 0, 0) |
| 42 | clabel = QLabel(self) |
| 43 | clabel.setMinimumSize(12, 12) |
| 44 | clabel.setMaximumSize(12, 12) |
| 45 | clabel.setStyleSheet("border-radius:6px;background: rgba(%s,%s,%s,%s);" % ( |
| 46 | color.red(), color.green(), color.blue(), color.alpha())) |
| 47 | layout.addWidget(clabel) |
| 48 | self.textLabel = QLabel(text, self, styleSheet="color:white;") |
| 49 | layout.addWidget(self.textLabel) |
| 50 | |
| 51 | def setText(self, text): |
| 52 | self.textLabel.setText(text) |