В фреймворке 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
🎬 **Step Back in Time with "Borrowed Wives" (1930): Laughter & Mismatched Marriages!** 🎉
Discover the hilarity of mistaken identities in the pre-Code comedy "Borrowed Wives." This 1930 classic is a must-watch for vintage film lovers! Subscribe now for more timeless gems and exclusive insights! 🌟🍿#ClassicMovies#HiddenGems
https://publicdomainmovies.info/borrowed-wives-1930/
**Unleashing the Secrets of *The Leopard Woman* (1920)!** 🎬✨ Step into the exotic world of jungle espionage and adventure! This silent gem stars the charismatic Louise Glaum as the enigmatic Leopard Woman. A spellbinding tale of love and intrigue awaits! 🐆💋 Subscribe now for more classic movie treasures! 🌟#ClassicCinema#HiddenGems
https://publicdomainmovies.info/leopard-woman-1920/