В фреймворке 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
🌍 The jet stream is a powerful, high-altitude wind that circles the planet, moving weather systems and helping shape climates on different continents thousands of kilometers apart. ✨
#atmosphere⚡#winds⚡#climate⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 In 2023, Cyclone Biparjoy spun over the Arabian Sea for nearly two weeks—a rare “very severe cyclonic storm” to last so long in this region, with winds impacting coasts over 1,000 kilometers apart. ✨
#cyclone⚡#disaster⚡#winds⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
H-h荒h地d之z风f- 荒地之风 Winds of the Wasteland (1936)
直达链接:https://pan.quark.cn/s/c838a322f878
#荒地之风#Winds of the Wasteland
链接:https://link3.cc/sf_com
#电影#喜剧#美国#50年代之前