В фреймворке 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
Really Good One to Watch
The daughter takes a step forward with each question.
The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress.
When the father steps forward for the final question, she hugs him. Father - Daughter ❤️
Children can be raised without knowing hardship.
But it is important to make them know that nothing they get comes so easily ❤️
#Inspiring
@InspiringThoughts
Really Good One to Watch
The daughter takes a step forward with each question.
The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress.
When the father steps forward for the final question, she hugs him. Father - Daughter ❤️
Children can be raised without knowing hardship.
But it is important to make them know that nothing they get comes so easily ❤️
#Inspiring
@InspiringThoughts
Really Good One to Watch
The daughter takes a step forward with each question.
The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress.
When the father steps forward for the final question, she hugs him. Father - Daughter ❤️
Children can be raised without knowing hardship.
But it is important to make them know that nothing they get comes so easily ❤️
#Inspiring
@InspiringThoughts
Really Good One to Watch
The daughter takes a step forward with each question.
The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress.
When the father steps forward for the final question, she hugs him. Father - Daughter ❤️
Children can be raised without knowing hardship.
But it is important to make them know that nothing they get comes so easily ❤️
#Inspiring
@InspiringThoughts
Really Good One to Watch
The daughter takes a step forward with each question.
The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress.
When the father steps forward for the final question, she hugs him. Father - Daughter ❤️
Children can be raised without knowing hardship.
But it is important to make them know that nothing they get comes so easily ❤️
#Inspiring
@InspiringThoughts