'Return a QLinearGradient object spanning from QPoints p1 to p2.'

def getGradient(self, p1=None, p2=None):

    if (p1 == None):
        p1 = QtCore.QPointF(0, 0)
    if (p2 == None):
        p2 = QtCore.QPointF((self.pos.max() - self.pos.min()), 0)
    g = QtGui.QLinearGradient(p1, p2)
    (pos, color) = self.getStops(mode=self.BYTE)
    color = [QtGui.QColor(*x) for x in color]
    g.setStops(zip(pos, color))
    return g
