В фреймворке 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
📢Peercoin Now is Available for Trade on SLEX!🎉
🔗Dear SLEXians, we're excited to inform you that Peercoin is now officially available for trading on the SLEX Centralized Exchange's spot market!
🔹Coin: Peercoin (PPC)
🔹TradingPair: PPC/USDC
🚀Join SLEX Centralized Exchange, deposit and start trading Peercoin on spot market!
#SLEXUpdate#PeercoinTrading#SpotMarket#SLEXTrading#PeercoinOnSLEX
Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter
🔥Take advantages of trading Peercoin (PPC/USDC) on SLEX Exchange🔥
Hey SLEXians!
🤩We're always on the lookout for ways to enhance your trading experience and we invite you to dive into the advantages of trading of Peercoin (PPC/USDC):
1️⃣ Spot market Trading: As a nod to our wonderful community and the excitement around Peercoin, enjoy spot trading the PPC/USDC pair on SLEX Exchange. More trades, more savings!
2️⃣ Safe HODLing: Store your Peercoin holdings securely in our fortified Exchange. HODL PPC with peace of mind knowing your assets are in safe hands and bring you profit.
3️⃣Supporting Sustainable Crypto: With Peercoin's focus on energy-efficient operations through its unique Proof-of-Stake consensus, you’re not only trading but also supporting a sustainable crypto initiative.
4️⃣Decentralization at Its Best: Peercoin's model ensures every coin holder, regardless of size, has a voice. By HODLing Peercoin, you can become a part of a great community and have an effect on developing a decentralized ecosystem.
🤝Join SLEX Centralized Exchange, take advantage of trading or HODLing PPC\USDC and boost your rewards!🚀
#TradePeercoinOnSLEX#SecureHODLing#SpotTrading#SLEXTrading#PeercoinTrading
Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter