В фреймворке 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
🌍 The El Niño and La Niña cycles shift ocean temperatures across the Pacific, affecting weather patterns around the globe, from droughts in Australia to floods in South America. ✨
#ElNino⚡#LaNina⚡#climate⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography 🌍
Prof. Tim Li's presentation on multi-timescale interactions in the global monsoon was a highlight at #OMC2026. His insights connect directly to his newly published paper exploring why some #LaNina events persist across multiple years. A compelling read. #AAS#AcademicSky#Science
via @aasjournal.bsky.social - Adv. Atmos. Sci.
Prof. Tim Li's presentation on multi-timescale interactions in the global monsoon was a highlight at #OMC2026. His insights connect directly to his newly published paper exploring why some #LaNina events persist across multiple years. A compelling read. #AAS#AcademicSky#Science
via @aasjournal.bsky.social - Adv. Atmos. Sci.