В фреймворке 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
📸 IN IMAGES | Venezuela Challenges Eurocentric Narratives in International Book Fair
President Nicolás Maduro inaugurated the 21st edition of the Venezuelan International Book Fair (FILVEN), announcing a new initiative to distribute printed books in schools nationwide.
The event, held in Caracas, features Egypt as the guest of honor, commemorating 75 years of diplomatic relations. With 18 publishers from 10 countries, FILVEN runs through July 13 before continuing across other Venezuelan states.
Follow the link to check out our gallery: https://venezuelanalysis.com/images/venezuela-challenges-eurocentric-narratives-in-international-book-fair/
#BookFair#Culture
Venezuela Honors South Africa at the 20th International Book Fair
At Venezuela’s 20th International Book Fair, South Africa was honored with 18 authors, and Nelson Mandela’s legacy was celebrated. The event also featured Jorge Ramos Tolosa’s book on Palestine.
Don’t miss out on the gallery by clicking here 👉🏼https://shorturl.at/PSCso
#bookfair#filven#filven2024#venezuela
📚Book Fair at Green University
📖A book fair was held at the university, bringing together students, faculty, and book lovers in a lively academic atmosphere. The event offered a wide selection of literature, encouraged reading culture, and created a space for meaningful exchange of ideas.
#BookFair#ReadingCulture#StudentLife#LoveForBooks
✉️[email protected]
☎️ +998 55 512 00 77
📍Location
🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube