В фреймворке 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
Updates
😏
Hello friends, We are currently working on a new animated sticker pack, which is expected to be published at the end of next week
😐. We should also publish an emoji pack in May.
New publish date: 2nd week of May
Edit:
why publishing date is delayed?
❓
We need to release the sticker pack on all social media platforms at the same time, and some platforms like LINE App require a review period before approving and releasing the sticker pack on their own sticker store, which is why the release was delayed.
#PeachCat#NewStickers#NewEmojis
Exciting news!
🎉
Peace Elite aka Game for Peace (Chinese PUBG) and Peach & Goma are teaming up in the world of Peacekeeper Elite!
🎮Tencent Games acquired gaming rights to iconic anime franchise, Peach and Goma! Get ready for epic adventures and adorable Games featuring Peach and Goma. 📱
#PeaceElite#GameForPeace#PUBG#ChinesePUBG#PeachCat#PeachGoma
@PeachLovesGoma
❤️