more enum goodness

Kovid Goyal kovid at kovidgoyal.net
Thu Jul 14 03:38:04 BST 2022


The stateChanged signal in PyQt6 delivers ints instead of Qt.CheckState,
which means the following breaks:

check_box.stateChange.connect(do_something)

def so_something(state):
   if state == Qt.CheckState.Checked:
      print('checked')

Instead one has to do:

def so_something(state):
   if Qt.CheckState(state) == Qt.CheckState.Checked:
      print('checked')


-- 
_____________________________________

Dr. Kovid Goyal 
https://www.kovidgoyal.net
https://calibre-ebook.com
_____________________________________


More information about the PyQt mailing list