В фреймворке 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 Milan Trade Fair Rho-Pero, Italy.
Salone del Mobile 2022 is taking place in Milan until June 12th.
The central element of the design of the Milan Trade Fair Rho-Pero, Italy, is a glass and steel structure that runs like a giant ribbon, caressing the large and small-scale building along its path and ending into a huge crater-like vortex.
The structure covers a raised walkway, flanked either side by eight giant exhibition halls. Nestling between them are a variety of smaller structures containing bars, restaurants and shops.
Architecture: Fucsas
Photos: Ramon Prat
#fuksas#fuksasarchitects#arch_shovel#architecture#milano#milan#italy#trade#fair#design#architecturephotography