def mouseMoveEvent(self, event): # 鼠标左键按下的同时移动鼠标 if event.buttons() and Qt.LeftButton : self.endPoint = event.pos() #进行重新绘制 self.update() 这个条件 if 的两项在使用中键右键拖动同样触发, 应该要像其他几个判断一样 == 就好了,