В фреймворке 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
🚀 Experience the Freedom of Trading!
📉With SLEX, you can enjoy affordable trading with ZERO spread. Trade your favorite cryptocurrencies as BTC, ETH and XRP without worrying about high fees eating your profits!💱
💰Say goodbye to excessive trading costs and register on SLEX Now and get 20$ welcome bonus till official launch - 17 of August! 💼
#SLEX#Trading#ZeroSpread#CryptoExchange
Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter
🚀 SLEX Hits $10M Daily Trading Volumes Just 3 Days In! 🚀
📈Get ready to witness history in the making! Just three days after the official launch of the SLEX exchange, we're thrilled to announce an incredible milestone: our daily trading volumes have soared to an impressive 10 000 000 USDT!📊
❤️The energy and enthusiasm from traders and investors like you have propelled us to new heights. This phenomenal achievement underscores our platform's immense potential and our community's unwavering support!🌈
🤝We invite you to join SLEX platform, deposit your account, and enjoy zero-spread trading on the spot market!
#SLEX#CryptoTrading#zerospread#SLEXtrading
Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter