В фреймворке 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
📢 How does offline earning work in #SingSingTycoon?
Simple! 🔍
💸 Offline Earning Speed = 50% of your Online Speed
🕒 Accumulation maxes out at 8 hours!
So, check back often and keep those profits rolling in! 🚀🎤 And don't forget to utilize x3 Button Power.
#KaraokeEmpire#IdleEarnings
🎤Announcement | Chat | X (Twitter) | Website | Game
🚀 The long-awaited SingSing Tycoon Game is about to launch! 🚀
⏰Save the schedule:14:00 UTC Today - Sep 21⏰
In just a few hours, you’ll officially step into the world of SingSing Tycoon! Get ready to build your own karaoke chain, upgrade booths, expand your shop, and grow your ultimate entertainment empire! 🎤💰
Exciting adventures await. Be prepared—this is going to be epic! 💥
#SingSingTycoon#GameLaunch#KaraokeEmpire#PlayToEarn#SingSing
Announcement | Chat | X (Twitter) | Website | Game