В фреймворке 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
🎉🎉 2,000 NFT Transactions Completed! 🎉🎉
The SingSing community is ON FIRE 🔥💎! Huge shoutout to all our karaoke tycoons making waves in the marketplace 🌟
Ready for more? Let’s keep the momentum going! 🚀🎤
#SingSingTycoon#NFTMilestone#KaraokeEmpire
🎤Announcement | Chat | X (Twitter) | Website | Game
🎉 Cheers to 30,000 NFT Transactions! 🎉
We’ve hit an incredible milestone thanks to our amazing community! 🚀 Here’s to more trades, more NFTs, and even bigger achievements ahead! 🔥
Thank you all for being part of this journey! 💎
#SingSing#NFTMilestone#30K
🎤Announcement | Chat | X (Twitter) | Website | Game
🎉10,000 NFT Transactions on SingSing Tycoon Marketplace!🎉
A huge thank you to our amazing community for making this milestone possible!
🚀 Your support keeps driving us forward, and we can't wait to see what’s next!
Here’s to many more NFTs and exciting moments ahead! 💥
#SingSingMarketplace#NFTMilestone#10KTransactions#Thank
🎤Announcement | Chat | X (Twitter) | Website | Game