В фреймворке 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
🌊Time to set exciting sail! 🏁
The Slex Team is thrilled to announce that we'll join the Aegean 600 race from 7 - 15 July 2023! ⛵️ This is not just about competition but about embracing the challenge and spirit of sailing.
🐳600 nautical miles, non-stop, in the dazzling blue Aegean Sea. We're excited to be part of a highly-rated and "must-do" race in the sailing world🌍
🌠We don't just innovate in the financial world but also ride the waves of excitement and challenge too! 🚀 Stay tuned for more updates on the Aegean 600 race adventure! #SLEXSailing#Aegean600
Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter
🌊 SLEX sails blew in the wind, and our hearts united!🏁
🌠The SLEX Team has finished on an extraordinary odyssey, sailing the Aegean 600 race with unwavering team spirit! ⛵️💨
🌟We conquered 600 nautical miles, uninterrupted, amidst the mesmerizing blue Aegean Sea. We danced with the waves, immersed in breathtaking scenery, and bonded as a crew 🐳🌊
🚀 We also continue to embrace challenges with boundless enthusiasm to revolutionize the crypto industry, so stay tuned!🏅
#SLEXSailing#Aegean600#TeamSpirit
Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter