Qt第三十六章:根据鼠标点击的区域获取控件

self.childAt(QPoint(100,100))

使用示例: 

 def mousePressEvent(self, event: PySide6.QtGui.QMouseEvent) -> None:
        # 窗口开始移动,这里我们可以设置可以拖动窗口的区域
        child = self.childAt(event.scenePosition().toPoint())  # 鼠标点击的控件
        if child is not None and child.objectName() == "widget":
            self.flag_is_moving = True

你可能感兴趣的:(Qt,for,Python,qt,开发语言)