В фреймворке 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
**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/
Unveiling “Behind Office Doors” – An Intimate Look into 1931’s Cinema Magic!🎬🎬🎬
Step back into the enchanting era with "Behind Office Doors" (1931)! 📽️ This romantic drama reveals the intriguing social dynamics and ambitions inside a bustling office. Starring the mesmerizing Mary Astor, the film captures the heart of Depression-era America 🌟. Invite nostalgia with this classic gem as you unlock its secrets. Dive deeper and be captivated by what goes *behind the scenes*! 🕵️♀️✨ *Ready for a cinematic journey?* #ClassicCinema#MovieMagic#MustWatch
https://pdmovies.substack.com/p/behind-office-doors-1931
John Wayne’s Hilarious Western Wisdom 🏜️#shorts#JohnWayne#WesternWisdom#ClassicCinema#Humor#MovieQuotes#WesternMovies#CowboyLife#OldHollywood#LegendaryActor#FilmScenes#RetroComedy#WesternHumor
https://pdmovies.substack.com/p/mclintock-1963-starring-john-wayne