В фреймворке 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
🤖A unique art exhibition Neuro Conflict will take place in Bali
📍 This weekend from 12 to 14 July, Superlative Gallery in Kuta will host an unusual exhibition called Neuro Conflict. Here you can experience a unique combination of art and modern technology, including neural networks.
🤖 The event will run for three days. The exhibition will feature works by international artists, interactive art installations, fascinating lectures on artificial intelligence, as well as performances and an auction.
@BaliNews
#wheretogo#exhibitions#Kuta
🧉Bali will host the official Arak Day tomorrow
🏝 Arak Day, the local palm vodka, is celebrated tomorrow, January 29.
ℹ️ Arak is a symbol of offering to the gods for a rich harvest, a form of gratitude.
📍 The official event will be held at GWK Park. The “Arak Berem Bali for the World” exhibition will also be held there.
🐲 The organizers of the celebration emphasize that Arak Day in Bali is not about drinking at all. Arak Day celebrations should be understood as a temple festival that is celebrated through prayer, not alcoholism.
@BaliNews
#holidays#events#exhibitions#culture