В фреймворке 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
🌍🌍✨✨✨✨#tv
🔴Yangiliklar
🇺🇿Oltiariq tumanida 🌱“Yashil makon” loyihasi doirasida Tuman Madaniyat boʻlimi xodimlari ishtirokida ko‘chat ekish ishlari amalga oshirildi.
Rasmiy sahifalarimizda bizni kuzatib boring:👇
📱Telegram | 📱Instagram |
📱Facebook | 📱YouTube
📺Smart TV Owners Want Multi-Device Viewing Options
Smart TV Owners watch a combination of both broadcast and online #TV. Further exploring their diverse TV engagement habits shows they frequently ventures beyond their smart TVs, watching their favorite TV shows and films across a broad range of devices, demonstrating that it’s the content, not the device, that governs preferences.
🚀@PerspectiveIX
🌀 http://prs.pctvix.co/TelegramIX