'Return the rotation produced by this item\'s transform (this assumes there is no shear in the transform)
If relativeItem is given, then the angle is determined relative to that item.'

def transformAngle(self, relativeItem=None):

    if (relativeItem is None):
        relativeItem = self.parentItem()
    tr = self.itemTransform(relativeItem)
    if isinstance(tr, tuple):
        tr = tr[0]
    vec = tr.map(QtCore.QLineF(0, 0, 1, 0))
    return vec.angleTo(QtCore.QLineF(vec.p1(), (vec.p1() + QtCore.QPointF(1, 0))))
