В фреймворке 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
📍 Kruger National Park, South Africa 🇿🇦
🦁 Kruger National Park is one of the most famous safari destinations in the world. It is home to Africa's "Big Five": lions, elephants, buffalo, rhinos, and leopards 🐘. The vast area of the park allows you to see wild animals in their natural habitat, and the diverse landscapes, from savannas to forests, make every trip unforgettable. 🌿
🚗 Tourists can explore the park by car or go on an organized safari with guides. Exciting sunsets, rare bird species, and the opportunity to see African life up close make this place a true adventure. The park is open year-round and ready to give bright emotions to every visitor! 🦓
#travel#safari#wildlife
safari
noun
uk /səˈfɑː.ri/ us /səˈfɑːr.i/
an organized journey to look at, or sometimes hunt, wild animals, especially in Africa.
[Source] 🐒🦒🦏
@googlefactss
#Africa#safari