В фреймворке 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
"A Journey of Unawareness to Empowerment"
A 30-year-old entrepreneur thought breast cancer couldn't happen to her. But during a routine work training, she discovered a lump through self-examination. The diagnosis: stage 2 breast cancer.
Her journey transformed her into a beacon of hope. "Early detection is key," she'd say. "Don't assume you're immune. Take control of your health."
Join our Breast Cancer Day webinar on Oct 19th, 18:00 GMT+3:
- Breast cancer risk factors and prevention
- Early detection methods
- Latest research and advancements
- Support systems and resources
Zoom link: https://us06web.zoom.us/j/89636772918?pwd=J05Hz0r3iiZG9B3EPbzJFPq50pqDzH.1
#BreastCancerAwareness#Empowerment#EarlyDetection#HealingJourney
Earli Secures $60M Funding
Earli raised $60 million in funding on December 19, 2024. The company aims to transform cancer treatment by focusing on early detection and intervention, making the experience more manageable.
#Earli#Funding#Cancer#HealthTech#EarlyDetection#Cure#Biotech#Investments
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