В фреймворке 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
#rstats#book
📕
Introducción a R: aprendiendo R sin morir en el intento.
Libro, en formato web y en español, ideal para aquellos interesados en iniciar el aprendizaje de #R a partir de los tipos de datos y la programación.
🌐ES
🔗Link
-----
Canal principal: @repo_science
Cupones: @freecoupons_reposcience
-----
#NYR2024#RStats
🖥
Excited to have Hadley Wickham, Chief Scientist at Posit, speaking at NY R Conference 2024! Dive into the evolution of data science and discover future trends with one of the pioneers in R programming.
rstats.ai/nyr.html
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----
#DataScience#rstats#DataScientist#dataanalysis#r#programming#dataviz#statistics
In an era driven by data, harnessing the power of statistics is key to deriving meaningful insights from the vast sea of information around us.
pyoflife.com/statistics-wit
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----
#ML#datascience#rstats#programming#dataviz#stats#analytics#machinelearning
6 formas de visualizar los resultados del análisis cluster jerárquico con R
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----
#programming#GPT4#GPT3#dataviz#stats#analytics#ML#AI#IA
🚀
Cómo programar más rápidamente en #RStats con #ChatGPT
Escribir código es un proceso lento, especialmente cuando estás aprendiendo #datascience por primera vez. ¿Y si pudieras acelerarlo?
🔗Link
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----