В фреймворке 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
'कृषिर्धन्या कृषिर्मेध्या जन्तूनां जीवनं कृषि:'
#AatmaNirbharKrishi के संकल्प के लिए प्रतिबद्ध पीएम के नेतृत्व में विभिन्न पहलों द्वारा समृद्ध और खुशहाल किसान का सपना हो रहा साकार।
#GoodGovernance
🔗https://youtu.be/R8Zm6zxuwG8
With dedicated efforts, #NewIndia's #GoodGovernance is reaching every panchayat.
From digital empowerment to sustainable development, the impact is visible.
#NayeBharatKiPanchayat#SamaveshiVikaas
December 9 -International Anti-Corruption Day
⚠️Corruption slows progress.
❗️Integrity, transparency, and the rule of law make societies stronger.
✅Only together can we fight corruption effectively.
#AntiCorruptionDay#Integrity#Transparency#RuleOfLaw
#StopCorruption#Compliance#GoodGovernance
✉️[email protected]
☎️ +998 55 512 00 77
📍Location
🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube