В фреймворке 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
🧬Welcome to RGB World!! 🧬
🎟Want to get the ticket to RGB's Ecosystem?🎟
Join Now👉https://app.galxe.com/quest/iVUN3rpKWghejAxArpB9Xy/GCS9Xtg79w
💰You will share a 520,000 $RNA Airdrop Prize Pool and experience the amazing opportunities BiHelix_ has in store for you in the coming weeks! 🪂🪂
#Bitcoin $BTC #UTXO#Giveaways2024
CELL Studio Secures Series A Funding
CELL Studio, a modular Bitcoin layer 2 platform, has successfully closed its Series A funding round with contributions from UTXO Management, CMS Holdings, and PAKA. The amount raised remains undisclosed.
!Funding Round
#Funding#Bitcoin#Layer2#CELLStudio#UTXO#Cryptocurrency#CMSHoldings#PAKA