В фреймворке 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
⚔️ The energy is soaring on Day 4 of #Tbilisi2025!
The Women’s Individual Foil – Table of 32 is packed with 🔥 intensity, emotion, and precision!
Who’s moving closer to the podium? 🥇🤺
🔴 Watch it LIVE: fencingtv.com
📊 Full results: bit.ly/44FJFbo
#FCA#FIE#FencingWorldChampionships#Fencing#Foil#Escrime#Esgrima
Cadet Asian Cup 2025 — Tashkent, Uzbekistan 🇺🇿
✅ Day 1 Results — Cadet Men’s Foil
1️⃣ ALBUSAIDI Ali 🇴🇲
2️⃣ CHEONG Pak Kio 🇲🇴
3️⃣ YETSEU Mansur 🇰🇿
3️⃣ TOKANOV Yevgeniy 🇰🇿
👏 Congratulations to the winners and all participants!
👉 Stay tuned and follow us for daily updates!
#CadetAsianCup#FencingAsia#FCA#FIE#Tashkent2025#Foil#Fencing#AsiaFencing
🔥 The action is on fire at #Tbilisi2025!
Men’s Sabre Table of 64 is delivering fierce battles and electric moments! ⚡🤺
Who will slice their way to the top? 🏆
🔴 Watch LIVE: fencingtv.com
📊 Full results: bit.ly/44FJFbo
#FCA#FIE#FencingWorldChampionships#Fencing#Sabre#Escrime#Esgrima#Foil#Epee