В фреймворке 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
¡Atención! 🚨
‼️El ultraderechista, Eduardo Verástegui ha puesto distancia con Trump y su política bélica.
Además, se lanzó con todo contra #BenjaminNetanyahu
"Jamás sería aliado de un régimen sionista genocida liderado por un criminal como Benjamín Netanyahu"
¿Qué opinas de sus palabras? 😱
In an unprecedented move following his shock proposal for the permanent resettlement of the more than two million Palestinians from Gaza to neighboring countries, President Donald Trump announced a controversial plan for the U.S. to take over the Gaza Strip. This statement, made during a press conference with Israeli PM Benjamin Netanyahu, raised eyebrows worldwide. A journalist cornered Trump so he sought Bibi’s help to complete his answer.
#UnitedStates#Israel#DonaldTrump#BenjaminNetanyahu#GazaStrip
Parla il Primo Ministro, #BenjaminNetanyahu, durante la conferenza organizzata da Jewish News Syndicate a #Gerusalemme: "#Israele ha impedito agli aerei iraniani di raggiungere la #Siria prima della cacciata di #Assad".
In his last interview as president of the United States, Joe Biden tells the story of his first meeting with Netanyahu in Israel after October 7. Bibi told Joe: “We did in Gaza what you did in Berlin.”
#UnitedStates#JoeBiden#BenjaminNetanyahu#Israel#Gaza#Palestine
The #ceasfire deal in #Gaza is on the ropes as #BenjaminNetanyahu tries to keep his government from collapsing after #Trump’s buddy #StevenWitkoff reportedly got the Israeli PM to cave.