def createWidget(self, data): """ Create a widget to be inserted into the legend The default implementation returns a `QwtLegendLabel`. :param QwtLegendData data: Attributes of the legend entry :return: Widget representing data on the legend ... note:: updateWidget() will called soon after createWidget() with the same attributes. """ label = QwtLegendLabel() label.setItemMode(self.defaultItemMode()) label.clicked.connect(lambda: self.itemClicked(label)) label.checked.connect(lambda state: self.itemChecked(state, label)) return label
def createWidget(self, data): label = QwtLegendLabel() label.setItemMode(self.defaultItemMode()) label.SIG_CLICKED.connect(lambda: self.itemClicked(label)) label.SIG_CHECKED.connect(lambda state: self.itemChecked(state, label)) return label