I am currently making a program where a user selects an image qpushbutton. I already have superseded mouseMoveEvent, mousePressEvent, and mouseReleaseEvent in the button class to get a movable button. The buttons are currently moving independently, but I would like the buttons to move so that the horizontal distance between them stays the same.
So currently in pseudo code I have:
import stuff import mvbutton as mv class MasterClass(QWidget): def __init__(self, *args): QWidget.__init__(self, *args) #more setup stuff, layout, etc self.addbutton(image,name,size) def addbutton(#args): self.button=mv.dragbutton(#args) #some more setup #now rename so that each button has its own name if name== "name1": self.name1=self.button else: self.name2=self.button self.button="" #more code to set up
I supersede the mouse motion/press/release functions in the dragbutton class. I cannot, therefore reference the new self.name#
there. So the self.move(pos)
in my dragbutton class cannot get the self.name#
because it is a different self. Any ideas on how I could get this to work? Thanks.