'This is called whenever the item is being moved and needs to
recalculate its offset.'

def recalculate_offset(self):

    view = self.__get_view()
    pos = view.mapFromScene(self.pos())
    view_box = self.__usable_viewbox()
    self.__corner_str = self.__get_closest_corner()
    viewbox_corner = getattr(view_box, self.__corner_str)()
    self.__offset = (viewbox_corner - pos)
