A push button is checkable (setCheckable(True)), and when it is checked - a method is called to establish a [bool=True] value. If I manually uncheck (2nd click) the button, [bool=False] <<=ideally.
Unfortunately, the second check merely reinstates the [bool=True] value. Is there any means of checking the state of a button, ergo; if-down = return True, if-up = return False?
Relevant code:
...
self.pushButtonSetBase.setCheckable(True)
self.pushButtonSetBase.toggled.connect(self.on_pushButtonSetBase_toggled)
...
@QtCore.pyqtSlot()
def on_pushButtonSetBase_toggled(self):
if self.pushButtonSetBase.isChecked:
print 'update the base!'
self.rowOverride = True
elif not self.pushButtonSetBase.isChecked:
print 'no base updates allowed!'
self.rowOverride = False
...
...
self.pushButtonSetBase.setCheckable(True)
self.pushButtonSetBase.toggled.connect(self.on_pushButtonSetBase_toggled)
...
@QtCore.pyqtSlot()
def on_pushButtonSetBase_toggled(self):
if self.pushButtonSetBase.isChecked:
print 'update the base!'
self.rowOverride = True
elif not self.pushButtonSetBase.isChecked:
print 'no base updates allowed!'
self.rowOverride = False
...
To copy to clipboard, switch view to plain text mode
Probably a simple solution - but seems to be a struggle @ current.
Thousand thanks.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Added after 23 minutes:
UPDATE:
This pyQt business is tricky... and fun.
Here is the working solution for anyone interested in the future.
...
self.pushButtonSetBase.setCheckable(True)
self.pushButtonSetBase.toggled.connect(self.on_pushButtonSetBase_toggled)
...
@QtCore.pyqtSlot(bool) #<<== the missing link
def on_pushButtonSetBase_toggled(self,checked):
if checked:
print 'update the base!'
self.rowOverride = True
elif not checked:
print 'no base updates allowed!'
self.rowOverride = False
...
...
self.pushButtonSetBase.setCheckable(True)
self.pushButtonSetBase.toggled.connect(self.on_pushButtonSetBase_toggled)
...
@QtCore.pyqtSlot(bool) #<<== the missing link
def on_pushButtonSetBase_toggled(self,checked):
if checked:
print 'update the base!'
self.rowOverride = True
elif not checked:
print 'no base updates allowed!'
self.rowOverride = False
...
To copy to clipboard, switch view to plain text mode
Bookmarks