В фреймворке 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
Bitcoin on #Bithumb suddenly dropped, trading over 10% below other markets.
Reports say a staff mistake during an airdrop sent 2,000 $BTC($133M) instead of a small KRW reward.
Some users sold it right away, causing the price to drop fast.
JUST IN : 💰🚨Bitcoin on #Bithumb suddenly dropped, trading over 10% below other markets.
Reports say a staff mistake during an airdrop sent 2,000 $BTC($133M) instead of a small KRW reward.
Some users sold it right away, causing the price to drop fast.
➖➖➖➖➖➖➖➖➖
📣@cryptonewstel
✨Vip join⭐️
🚨 DWF Labs has deposited all 170K $CYBER to #Bithumb at $8.6 on average ($1.46M) in 7 transactions over the past 24 hours.
➡️ DWF Labs will earn an estimated profit of $697K (+91.1%) from $CYBER if truly sold just now.
👉 More details: https://platform.spotonchain.ai/signal-details/dwf-labs-closed-the-first-cyber-deal-for-great-profit-516
👉 Visit our discord: https://discord.com/invite/Xh7cReej7n