В фреймворке 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
New airdrop: Optimism OP
Reward: 40 #PO worth $120
Distribution date: 10th March, 2023
🔗Airdrop Link: airdrop page
-Complete all tasks of the airdrop
-Submit your BSC wallet address
-registration process completely
Done ✅Done✅Done✅Done✅
⚠️Please remember: We are airdrop hunters and only participate in free airdrops, do remember that airdrop tokens are free.
#Polonia
Un gruppo di parlamentari e senatori hanno annunciato la formazione di un nuovo partito chiamato "Centrum dla Polski"/#CdP, che farà parte della coalizione guidata dal #PSL|EPP. Il partito, che si prefissa ideologicamente come liberal-conservatore e democristiano, dovrebbe comprendere alcuni ex membri dell'ala conservatrice del #PO|EPP espulsi nel corso degli anni.
In foto il logo del partito.
@UltimoraPolitics
#Polonia🇵🇱
#Presidenziali
❗️Rafał #Trzaskowski (#PO|PPE) e Karol #Nawrocki (Ind.) si sfideranno al secondo turno, che si terrà domenica 1º giugno.
@TuttoElezioni