В фреймворке PyQt (и PySide тоже) часто встречается настройка чего-либо с помощью так называемых флагов.
widget.setWindowFlags(Qt.Window)
Взаимодействие нескольких флагов делается с помощью бинарных (или побитовых) операторов.
Несколько флагов можно указать с помощью оператора "|"
list_item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
исключить флаг из уже имеющегося набора можно так
list_item.setFlags(list_item.flags() ^ Qt.ItemIsEnabled)
Добавить новый флаг к имеющимся можно так
list_item.setFlags(list_item.flags() | Qt.ItemIsEnabled)
А проверка наличия делается так
is_enabled = item.flags() & Qt.ItemIsEnabled > 0
Почему именно так? Всё дело в том как именно работают побитовые операторы. Но об этом в следующем посте.
#qt
This chat is all about kobolds and those who love them, and also own them!~ if you like those little mischievous things then you better hop in and start loving on them!~
#Chat
#Partner
https://t.me/joinchat/f7PyhKiPzrE1MGEx
Do you like beefy bois? Wanna get squeezed by some swole buff guy? Then maybe stop by this channel and oggle at all these muscled studs~
#Channel
#Partner
@snookmusclescorner
This chat is all about kobolds and those who love them, and also own them!~ if you like those little mischievous things then you better hop in and start loving on them!~
#Chat
#Partner
#NSFW
https://t.me/joinchat/f7PyhKiPzrE1MGEx
#MoveWith#Live#Workout#Partner
Join the MoveWith: Live Workout Partner beta on ✈️#TestFlight
🔗 Link: https://testflight.apple.com/join/uEXQqJ2V
Shared by Dimitri