В фреймворке 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
🇬🇧It Happened on Hyde Street_Devour #01
🇷🇺Истории улицы Хайд_Лакомка #01
Бодипозитив? НЕ, не слышал! Узнайте, как девочки относятся к собственному весу и на что готовы пойти ради похудения! Окунитесь в очередную историю бедолаг, которым не повезло попасть на... улицу Хайд!
#комикс#comics#хайд#hyde
#ночноечтиво
#image
#shell#aesthetic#dark_mode#dynamic#hyde#hyprdots#light_mode#themes#unix_porn#wallpapers
HyDE is a clean, modular, and visually appealing development environment designed for Hyprland on Arch Linux and some Arch-based distros. It offers easy installation via a script that auto-detects NVIDIA cards and configures necessary drivers, but it may conflict with existing desktop environments or theming. You can customize it with many official and community themes using a tool called themepatcher. HyDE keeps your configuration organized and separate from core scripts, making updates safer and simpler. It also supports running in a virtual machine for testing. Joining the HyDE Discord community helps you get support and share ideas. This setup benefits you by providing a stylish, maintainable, and customizable desktop environment with a smooth update process and community support.
https://github.com/HyDE-Project/HyDE