В фреймворке 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
🪂Airdrop » LayerX ✅️
💲Reward: Worth of $3000 #Manta
💎Presents Ratings: ⭐️⭐️⭐️⭐️⭐️
👑Winners: all user participants
➡️Airdrop Page Join For Layer X
📚 How to Join Airdrop?
↪️ layer X.... U earn valuable point just by your daily logins
↪️ Follow Twitter page Retweet the Pinned Post & Tag 3 Friends. (Required Task)
✏️Notes:Make sure to complete all tasks to receive rewards.
ℹ️Distribution Date: Layer X we will be on 28th April 2024
💥In the last 24 hours, $MANTA surged to $3.333, marking an increase of over 18%.
With the booming MantaNetwork ecosystem, here is the guide for you on how to get your #Manta wallet on the #TokenPocket mobile wallet and Chrome Extension Wallet.
Full Guide👉https://help.tokenpocket.pro/en/wallet-operation/how-to-create-a-wallet/manta
【Details】https://twitter.com/TokenPocket_TP/status/1750418329746210831
【Powered By】Crypto Box