This question is a slight modification of the bounding box example. I'm trying to understand how to draw simple shapes. I just want to replace the bounding box with a diagonal line from the upperLeft point to the lowerRight point. However, QLine() does not appear to have a show() method and viewport() has no addItem() method. So, I think the line is not being displayed. Here is my modification of the showBoxes method:
def showLines(self): while self.boxes: self.boxes.pop() #self.boxes.pop().deleteLater() #Qline has no deleteLater(). Does that matter? viewport = self.edit.viewport() for start, end, ident in db: rect = self.edit.getBoundingRect(start, end) x = rect.x() y = rect.y() h = rect.height() w = rect.width() line = QLine() #QRubberBand(QRubberBand.Rectangle, viewport) line.setLine(x,y,x+w,y+h) #box.setGeometry(rect) # need to show line here? self.boxes.append(line)