В фреймворке 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
Joan of Arc was captured in 1430 during the Hundred Years’ War by the Burgundians, who then handed her over to the English. The preliminary hearings and interrogations in her trial began on January 3, 1431, with the official trial sessions starting on January 9, 1431. She faced charges including heresy and cross-dressing in a politically motivated trial aimed at discrediting her and weakening French morale. Despite her bravery and clear faith, she was found guilty and burned at the stake in 1431 at just 19 years old. Later, she was declared a saint and became a symbol of French unity and courage. ⚔️🔥🙏
[Read more]
#JoanOfArc#History#Heroine#MedievalTimes#SaintJoan