В фреймворке 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
🔥 LAST DAY of Top Blacksmiths #2! 🔥
⚒️ Top 50 Blacksmiths will share 150,000 AURA + $100 $SING! 🏆
📌 Ranking rules:
✅Leaderboard is based on Points
✅If tied, higher pot tier ranks higher
⏳ EndsFeb 5, 14:00 UTC – make your final push! 🚀
#TopBlacksmiths#AuraRewards
🎤Announcement| Mystic Garden Game |Chat| Spotlight Channel
🌟Mystic Garden is Officially Open!🌟
🎉 The wait is over—step into the magic now!
🔸AURA Launchpool Stakers: Your AURA rewards are ready!
🔸Beta Testers: Enjoy 2x AURA on your deposits and beta test reward as a special thank-you!
🔸Everyone: It’s time to explore, grow, and thrive in Mystic Garden!
Let the adventure begin! 🌱✨
Play Now: https://t.me/mystic_garden_bot/app
#MysticGarden#GameLaunch#AURARewards