В фреймворке 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
President Maduro addressed recent destabilization attempts against Venezuela during a conversation with UN Secretary General Guterres, accusing the US of promoting regime change and violating international law.
This follows the arrest of several foreigners, including a US Navy SEAL, accused of plotting to kill Maduro and other officials. Additionally, the UN has come under pressure from regional governments to investigate Venezuela's human rights situation.
Read the full report here 👉🏼https://shorturl.at/Ow5Cv
#AntonioGuterres#HumanRights#UnitedNations
'We need to inject cash' into Afghanistan, says U.N. Chief
U.N. Secretary General Antonio Guterres said the international community must find ways to inject cash directly into Afghanistan’s economy to avert its total collapse as a growing humanitarian crisis impacts half the population.
#News#Reuters#Afghanistan#AntonioGuterres#WorldBank#AfghanEconomy
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖