QPoint localPos = button->pos(); // 局部坐标 (相对于父窗口的坐标) QPoint globalPos = button->mapToGlobal(QPoint(0, 0)); // 获取全局坐标