В фреймворке 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
#AntimicrobialResistance is when medicines like #antimalarials, tetracycline, septrin, and amoxicillin no longer treat diseases they cured previously.
Using antimicrobials "anyhow " is making the treatment of common infections more difficult.
Let us work together to save medicines.
#BeAntimicrobialsAware
#AntimicrobialResistance is when medicines like #antimalarials, tetracycline, septrin,
Amoxycillin no longer treat diseases they cure previously.
Using antimicrobials "anyhow " is making the treatment of common infections more difficult.
#WorldAntimicrobialAwarenessWeek2022
#AntimicrobialResistance is when medicines like #antimalarials, tetracycline, septrin, and amoxicillin no longer treat diseases they cured previously.
Everyone everywhere, including users and non-users of #antimicrobials has a role to play to prevent #AMR.
#BeAntimicrobialsAware