В фреймворке 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
🌟 Exciting news! SingSing Mini App has launched Version 2! 🚀
Enjoy these amazing new feature:
🚨Claim RUBY: absolutely gas-free! 🎉 NO FEES, JUST RUBY!
⚠️ Remember, you only need to connect your wallet when minting tokens on-chain and you will soon be able to use RUBY in various games and projects within the SingSing ecosystem.
Also, a friendly reminder: Ruby token halving starts at 14:00 UTC. ⏰
Don't miss out on these upgrades and make the most of your SingSing experience!
#SingSingClub#RubyToken#CryptoUpdate
🚨 SingSing Mini App Version 2 Update! 🚨
Here's what's new:
The RUBY in the "RUBY Balance" section is now off-chain RUBY, which you can claim completely gas-free! 🎉
1️⃣When you click the "Check Mission" button below the RUBY Balance Section, you'll see a "Mint" button. Hit "Mint" to convert your off-chain RUBY into on-chain RUBY. 🔄
2️⃣Scroll down to your Token List. The RUBY displayed here is your on-chain RUBY balance. After minting, your RUBY from the RUBY Balance section will move to this Token List balance. 💎
3️⃣With this new version, you can earn more RUBY with lower costs. Make the most of it and start stacking up RUBY for upcoming events with SingSing and our partners! 🚀
#SingSingClub#RUBYToken#CryptoUpdate#Version2