В фреймворке 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
😄Issue
➖➖➖➖➖➖
🔘Issue, as a noun, can be an important topic that people are talking about.
🔜The environment is an important issue.
🔜The energy crisis is a big issue for many people.
🔘An issue can also be 'a problem'.
🔜If you find any issues with our videos, please let us know.
🔜Your work was good, but there are a few issues you need to address.
🔘As a verb, we can use 'to issue'. This describes something being ready or available, often for official purposes.
🔜I'm waiting for reception to issue my work pass.
🔜my new driving license has finally been issued.
🔘We can call a newspaper or magazine an issue if it belongs to a certain title.
🔜Read about this story in next week's issue!
#Issue👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys