В фреймворке 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
🆓REDEEM CODES🆓
👀#Genshin🎁#Codes This Week
Aino has brought her humanoid robot 🔥🤖#Ineffa to life!
🚩The very first ARTIFICED character in the entire history of Genshin!
🗣✨Get ready for the upcoming Genshin Impact 5.8 update! It will come at the end of July, with this fresh new face!
🎁💎【 GS58YTPGFY 】NEW!! - 30k mora, three hero's wit, five mystic enhancement ore, three vajrada amethyst slivers, and three teachings of conflict
✅Genshin Impact July 2025 Codes (Full List)
Add @APKFreeDownloader_Bot to get any apk you want.