В фреймворке 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
🗺Where will you swipe next?
💳GuPay is still live — where will you swipe next?
New York, Seoul, Manila, Miami… — We’ve already seen GuCard go global. 🌎
But for us, every payment counts — whether it's coffee near home or a flight across borders
📌 Let's share some moments with us:
1️⃣Use GuCard this week.
2️⃣Snap a photo and post to your X .
3️⃣Use hashtag #Gumart#GuPay
Let’s show the world what crypto can actually do.🛒
🥉 GuCard Champions' League – Third Place Revealed!🛍
After NYC and Korea, we now head to the Philippines!
Big congratulations to @mkddavidson, our 3rd Place Winner, who showed how easy it is to grab snacks at the supermarket or order McDonald’s - all using GuCard and GTP. 👍
You’ve won 1,000 USDT, already loaded to your GuCard!
🎥 Watch the winning video: link
GuCard is going global - and this is just the beginning!✋
#GuMinigame#GuPay#GuGoGlobal#GuCard