В фреймворке 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
#Syria | W. #Damascus: Alaa Khazama was killed and his body was found today, April 12, 2026, in the #Barada River area in rural Damascus. He had missing for five days after leaving for work as a taxi driver.
Alaa Khazama was originally from the rural outskirts of #Baniyas and was a member of the #Alawite community.
#Baniyas | #WesternSyria : The statue of the Virgin Mary at a shrine known as #alBasiya Shrine, located in the #alKharab area in the Baniyas countryside, was vandalized yesterday, March 29, 2026.(photo to the left)
It is worth noting that a previous statue of the Virgin Mary at the same shrine had been vandalized on February 19, 2026 (photo to the right). Locals replaced it, only for it to be vandalized a second time.