В фреймворке 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
Language isn’t just a way to communicate—it’s the soul of our civilization and culture, as PM Narendra Modi says.
On #InternationalMotherLanguageDay, we celebrate Bharat’s rich linguistic heritage and the voices that make us one vibrant community!
With 11+ languages, MyGov, your citizen engagement platform ensures your voice is heard. Quizzes, contests, pledges, and more, because India’s diversity is its true strength.
Be a part of the MyGov family—be a MyGov Saathi!
🔗 Explore more: https://linktr.ee/MyGovSocial
#CitizenEngagement
#MyGovSaathi
Pulse Of A Confident India!
From citizen engagement and India stories to the India-AI Impact Summit 2026 and Pariksha Pe Charcha 2026, this edition also highlights 140 Crore Citizens, 140 Crore Solutions, ‘India is Riding the Reform Express’, Seva Teerth, key Cabinet Decisions and Social Media Engagement. #MyGovPulse captures the many dimensions of India’s progress and participation.
Visit: https://static.mygov.in/static/s3fs-public/ebook/India-AI-Impact-Summit-2026/index.html
#NewIndia
#ReformExpress
#IndiaAIImpactSummit2026
#CitizenEngagement