В фреймворке 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
Live: Get your virtual panda cuddles from Chongqing Zoo!
It's Saturday! Time for some super cute pandas. Yu Ai, Yu Ke, Mang Cancan, Qi Sanmei and Liang Yue in Chongqing Zoo get ready for clumsy rolls, silly play and fluffy cuteness. Join us to have a look! #panda
via CGTN
🩸🅰️🩸🩸🅰️
A Chinese zoo is under fire again for passing off dogs as pandas. This is the third time that people have been tricked by painting ordinary chow chows as pandas.
Visitors began to suspect that they weren't pandas when the spotted furry creatures started barking and panting like dogs.
The plan was perfect. What could go wrong?
#Panda#China
MARKHEMIST