def hash_path(path: QPainterPath) -> int: h = 35891237 ^ path.fillRule() for i in range(path.elementCount()): el = path.elementAt(i) h ^= hash((el.type, el.x, el.y)) return h