В фреймворке 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
#HappyEaster from all of us at the Nigeria Centre for Disease Control and Prevention.
May this day fill you and your loved ones with joy, happiness, and renewed health.
Let's celebrate the gift of hope and good health as we strive towards healthy living.
The Nigeria Centre for Disease Control and Prevention (NCDC) wishes you a joyful and peaceful Easter. ✝️
As we celebrate this season of hope, renewal, and new beginnings, we are reminded of the importance of protecting our health and the wellbeing of those around us.
While you spend time with loved ones, remember to practice good hygiene, stay informed, and make choices that keep our communities safe.✅
May this Easter bring you renewed strength, happiness, and good health.
Stay safe, stay informed, and enjoy the season. 🌿
#HappyEaster#StayHealthy#NCDCNigeria