'Returns a QTransform that maps from rectangle ``r1`` to ``r2``.'

@staticmethod
def transform_from_rects(r1, r2):

    if ((r1 is None) or (r2 is None)):
        return QTransform()
    if ((r1.width() == 0) or (r1.height() == 0) or (r2.width() == 0) or (r2.height() == 0)):
        return QTransform()
    tr1 = QTransform().translate((- r1.left()), (- r1.top()))
    ts = QTransform().scale((r2.width() / r1.width()), (r2.height() / r1.height()))
    tr2 = QTransform().translate(r2.left(), r2.top())
    return ((tr1 * ts) * tr2)
