В фреймворке 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
🆕We just released TP Wallet's New Version on iOS! 🔺2.1.1🔺
🔵 Support #Passphrase.
🔵 Support #Ordinals. #BTC
🔵 Support for WalletConnect V2 multi-chain switching.
🔵 Support 🇧🇩Bengali, 🇻🇳Vietnamese, 🇵🇭Filipino, 🇮🇩Indonesian, 🇷🇺Russian, 🇫🇷French, 🇩🇪German, 🇹🇷Turkish, and 🇪🇸Spanish languages.
👉https://tokenpocket.pro
🔐Strengthening your secret recovery phrase shield!
✅TokenPocket Mobile Wallet (Both Android and iOS versions) now offers support for the #Passphrase feature! With #Passphrase, you can provide an extra layer of protection to your secret recovery phrase.
Before utilizing a passphrase, it's essential to acquire some fundamental knowledge. 👇👇
https://medium.com/@tokenpocket-gm/about-passphrase-f8ed70c7bec6
#TokenPocket#cryptomarket#Crypto
【Details】https://twitter.com/TokenPocket_TP/status/1706584726348173506
【Powered By】Crypto Box
🆕We just released TokenPocket's New Version on Android! 🔺1.8.5🔺
🔵 Support #CCTP Protocol.
🔵 Support users to edit Gas Fee on the Markets page.
🔵 Add token security detection to the Markets page.
🔵 Support custom network transactions on the Markets page.
🔵 Support custom #Nonce.
🔵 Support #Passphrase.
🔵 Support WalletConnect V2 on trondao.
🔵#EIP1559 Gas Fee model supports #Layer1 and #Layer2 Gas Fee display.
🔵 Support #BTC transaction acceleration.
🔵 Support shared SDK panel and DApp panel.
🔵 Support #Urdu🇵🇰 and #Arabic languages.
🔵 Upgrade wallet migration security reminders.
🔵 Optimize wallet creation/import page.
🔵 Optimize Cold Wallet signature operations.
🔵 Optimize users' experience.
👉https://www.tokenpocket.pro/
【Details】https://twitter.com/TokenPocket_TP/status/1701494173398876369
【Powered By】Crypto Box