Hi Guys! I’m new to this community and to programming in python at all, so don’t judge me for stupid questions
I’m trying to create one script for Maya and which will use similar functionality to PS layers visibility with eye icon.
So basically I’m using QPushButton class with icon. And I want to change this eye icon when button is clicked.
I’m using two icons (opened eye and closed eye) and function to connect button.setIcon(), but I can’t find what state or flag should I use to query which icon is used.
Here is my code :
self.eyeicon_1 = QtGui.QIcon(os.path.join(ROOT, “icons”, “vis.svg”))
self.eyeicon_2 = QtGui.QIcon(os.path.join(ROOT, “icons”, “invis.svg”))
self.visButton.setIcon(self.eyeicon_1)
self.visButton.setIconSize(QtCore.QSize(16,16))
self.visButton.setFlat(True)self.visButton.clicked.connect(self.eyeChanged)
def eyeChanged(): if self.visButton.????() == self.eyeicon_1: self.visButton.setIcon(self.eyeicon_2) elif self.visButton.????() == self.eyeicon_2: self.visButton.setIcon(self.eyeicon_1)
Could you please help me to find a solution?
Thanks!