В фреймворке 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
🚘 has presented modernized coupe and convertible LC
The model range, produced since 2017, got slightly modernized exterior and new interior materials, but at the same time received a more rigid body. Additional struts installed under the floor in the area of the front and rear axles should favorably affect the handling.
The Lexus LC engine range consists of a five-liter V8 with 477 horsepower or a 3.5-liter V6-based hybrid unit with 359 hp.
Starting from $107,625.
@CarsNews
#Lexus#hybrid#convertible
🚗✨ Exciting News from Mercedes-Maybach! ✨🚗
Get ready for the debut of the stunning new convertible on August 15th at the prestigious Pebble Beach! 🌊🏖️
The highly anticipated model has been teased since 2022, and we can't wait to see it in all its glory! 🤩
🔍 Fuel Efficiency: The Mercedes-Maybach SL boasts an impressive fuel consumption of 13.7 liters per 100 km*, closely matching the non-hybrid Mercedes-AMG SL 63 with its powerful 4.0L V8 engine, delivering a thrilling 585 hp and 800 Nm* of torque! 💨🔥
#MercedesMaybach#Convertible#LuxuryCars#PebbleBeach#CarDebut#FuelEfficiency#AMG#V8Power#Auto