В фреймворке 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
🚨 Freedom for Palestinian journalist Mustafa Ayyash 🚨
Austria is forcibly detaining Mustafa Ayyash since his arrest, without any judicial ruling, and has disabled his social media accounts to silence his voice.
A Palestinian journalist, a voice for Gaza and Palestine, now needs our voices.
📢 We demand immediate disclosure of his safety and his immediate release!
#Prisoners
#FreedomForMustafaAyyash
#ExecutionOfPalestinianPrisoners
#PrisonersExecutionLaw
O Allah, grant relief to all Muslim prisoners and restore their freedom and safety swiftly, not delayed.
#Prisoners
#FreedomForMustafaAyash
#ExecutionOfPalestinianPrisoners
#ExecutionOfPrisoners
#FreeMustafaAyash
#FreedomForMustafaAyashFromAustrianPrisons
O Allah, grant relief to all Muslim prisoners, and restore to them freedom and safety without delay.
#Prisoners
#FreedomForMustafaAyyash
#ExecutionOfPalestinianPrisoners
#PrisonersExecutionLaw
#freemustafaayash
#FreedomForMustafaAyyashFromAustrianPrisons
#ExecutionLaw
Be Daraa, protecting the prisoners and those released.
#PrisonersAndReleasedFriday
#PrisonersAreARedLine
#WeWillOpenOurAlAqsa
#SaveThePrisoners
#Prisoners
#FreedomForMustafaAyash
#ExecutionOfPalestinianPrisoners
#ExecutionOfPrisoners
#FreeMustafaAyash
#FreedomForMustafaAyashFromAustrianPrisons