В фреймворке 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
💊🇺🇸FDA APPROVES BREAKTHROUGH DRUGS FOR RARE DISEASES
🔹 Yuviwel approved Feb 27 for dwarfism growth — first-ever treatment for kids 👶
🔹 Loargys gets green light for ultra-rare Arginase 1 Deficiency 🧬
🔹 Bysanti breakthrough schizophrenia drug hits market February 20th 🧠
🔹 Wellcovorin approved March 10 for cerebral folate deficiency 🧪
🔹 Takeda's narcolepsy drug oveporexton submits for late March review 😴
5 novel drug approvals in first quarter — fastest pace since 2023! 📈
Rare disease patients get hope as FDA accelerates orphan drug pipeline... 🙏✨
#FDA#MedicalBreakthrough#RareDiseases#DrugApproval
@america
Amanda Smith, 35, had Type 1 diabetes and needed insulin daily. In February 2023, doctors gave her new islet cells made from stem cells. By August, she no longer needed insulin because her body made it again. This treatment helped her live without constant insulin shots.💉🧬
[Read more]
@googlefactss
#StemCellTherapy#DiabetesTreatment#HealthFacts#MedicalBreakthrough
New kidney treatments help people with kidney disease protect and preserve their kidney function. New drugs slow disease progression. Doctors can target the exact cause of kidney problems. Early tests catch issues sooner, and combination therapies help manage complications like anemia. People with kidney disease have more options to maintain their health.
🩺💊🧬✨
[Read more]
@googlefactss
#KidneyHealth#CKD#MedicalBreakthrough#EarlyDetection#PrecisionMedicine#HealthyLife