В фреймворке 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
🛍DEX aggregator from the TON Diamonds team
The team launched their Mini App of Dex Diamonds and updated the interface, now it is much more convenient and faster to “swap” tokens directly from #telegram, receiving #cashback in tokens for it ✨#GLINT.
#TonDiamondsDex achieved an impressive result — more than 100,000 transactions, and a trading turnover of $50 million, and this was achieved in 8 months.
Now there are several aggregators in the TON arena that provide a similar service. Let's see who comes out ahead!
DexDiamondsBot | Channel