I use a qcustomplot to draw 4 lines in "realtime". I am also drawing a legend with all 4 lines. Is there a way to hide and show the legend items. In case only 2 of the 4 lines are needed (other 2 lines a set to invisibe, setVisible(false)), still all 4 items are visible in the legend. How to adjust the legend to the lines shown in the plot?