В фреймворке 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
🇺🇸🇮🇱⚔🇮🇷🛩️The Watchful Eye Over the Gulf
✍🏽By Red Nile Media | Geopolitical Analysis
A U.S. Navy MQ-4C Triton spy drone has been conducting high-altitude surveillance over the Persian Gulf and Strait of Hormuz, flying out of the UAE—a subtle but powerful signal amid rising U.S.–Iran tensions. Far from routine, this deployment follows a familiar escalation playbook: persistent intelligence gathering, psychological pressure, and strategic positioning that often precede larger moves.
🔹 Why the shift from Qatar to the UAE? What message is being sent to Tehran? And how does this fit into past confrontation patterns in the region?
🔗Read the full analysis:
📡@rednile12
Geopolitics | Multipolarity | Sovereignty | Strategic Reality
#Iran#USA#UAE#Qatar#PersianGulf#Geopolitics#MilitaryIntelligence#MiddleEast#RedSea#ISR#MQ4C#RedNileMedia
🇺🇸🇮🇱⚔🇮🇷🛩️The Watchful Eye Over the Gulf
✍🏽By Red Nile Media | Geopolitical Analysis
A U.S. Navy MQ-4C Triton spy drone has been conducting high-altitude surveillance over the Persian Gulf and Strait of Hormuz, flying out of the UAE—a subtle but powerful signal amid rising U.S.–Iran tensions. Far from routine, this deployment follows a familiar escalation playbook: persistent intelligence gathering, psychological pressure, and strategic positioning that often precede larger moves.
🔹 Why the shift from Qatar to the UAE? What message is being sent to Tehran? And how does this fit into past confrontation patterns in the region?
🔗Read the full analysis:
📡@rednile12
Geopolitics | Multipolarity | Sovereignty | Strategic Reality
#Iran#USA#UAE#Qatar#PersianGulf#Geopolitics#MilitaryIntelligence#MiddleEast#RedSea#ISR#MQ4C#RedNileMedia