В фреймворке 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
😄Advance
➖➖➖➖➖➖
🔘 Advance, the verb, can mean develop, improve and move forward.
🔜 You'll advance if you continue to study this hard.
🔘 Advance in this way can also be used as a noun.
🔜 There was an advance in sales when the software was updated.
🔘 Advance can be an adjective that means early.
🔜 I wish you'd given me advance warning of the redundancies.
🔘 If you ask for an advance, you ask to be given a payment before you are usually paid.
🔜 I asked for an advance because I had to pay a big bill.
#Advance👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
😄Advance
➖➖➖➖➖➖
🔘 Advance, the verb, can mean develop, improve and move forward.
🔜 You'll advance if you continue to study this hard.
🔘 Advance in this way can also be used as a noun.
🔜 There was an advance in sales when the software was updated.
🔘 Advance can be an adjective that means early.
🔜 I wish you'd given me advance warning of the redundancies.
🔘 If you ask for an advance, you ask to be given a payment before you are usually paid.
🔜 I asked for an advance because I had to pay a big bill.
#Advance👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
#Elezioni#RegnoUnito#Suppletive#GortonDenton
Risultati definitivi:
Affluenza: 47,6%
Hannah #Spencer (#Greens|G/EFA): 40,6%
Matt #Goodwin (#Reform|Destra populista): 28,7%
Angeliki #Stogia (#LAB|S&D): 25,4%
Charlotte #Cadden (#CON|Centro-destra): 1,9%
Jackie #Pearcey (#LDEM|RE): 1,8%
Sir Oink #ALot (#MRLP|Satirici): 0,4%
Nick #Buckley (#Advance|Estrema destra): 0,4%
Joseph #OMeachair (#RejoinEU|Europeisti): 0,3%
Dan #Clarke (#LPUK|Libertari): 0,1%
Sebastian #Moore (#SDP|Centro-sinistra conservatrice): 0,1%
Hugo #Wils (#CL|Estrema sinistra): 0,1%
Greens GUADAGNA su LAB.
I Verdi inglesi vincono per la prima volta nella loro storia una elezione suppletiva.
@OsservatorioEsteri