'Return a QLinearGradient object.'

def getGradient(self):

    g = QtGui.QLinearGradient(QtCore.QPointF(0, 0), QtCore.QPointF(self.length, 0))
    if (self.colorMode == 'rgb'):
        ticks = self.listTicks()
        g.setStops([(x, QtGui.QColor(t.color)) for (t, x) in ticks])
    elif (self.colorMode == 'hsv'):
        ticks = self.listTicks()
        stops = []
        stops.append((ticks[0][1], ticks[0][0].color))
        for i in range(1, len(ticks)):
            x1 = ticks[(i - 1)][1]
            x2 = ticks[i][1]
            dx = ((x2 - x1) / 10.0)
            for j in range(1, 10):
                x = (x1 + (dx * j))
                stops.append((x, self.getColor(x)))
            stops.append((x2, self.getColor(x2)))
        g.setStops(stops)
    return g
