В фреймворке 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
🍿 Government Cheese: Apple TV+ Goes Full Surreal with This Wild Comedy
📆Premiere: April 16, 2025
🎭Genre: #Comedy · #Surreal
David Oyelowo (‘Selma’, ‘Nightingale’) leads Government Cheese, a wild, satirical take on the American Dream. Set in 1969, the show follows Hampton Chambers, a con man fresh out of prison who returns to his family with big dreams—only to find they’ve moved on without him. His grand plan? A bizarre invention, a pile of debt, and a “righteous path” full of chaos.
Think Fargo meets Wes Anderson, but with a fresh, Black-led perspective. Apple TV+ is leaning hard into quirky crime comedies, and this one, with Pharrell Williams on the soundtrack, feels like a bold, must-watch gamble 🎶🔥. Will it be a cult classic or just a wild experiment? We’ll find out soon.