В фреймворке 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
🗣#REX — Grab Your Tokens from the T-REX Airdrop
🗓 Deadline: May 26
What to do:
✔ Visit the website
✔ Finish the quests
🟠 Rewards are confirmed via Galxe
🟠 Super quick — done in under 2 minutes
☝️ Start trading on Bybit
Crypto Drop Club 👉 SUBSCRIBE
🔥 Airdrop: $Rex
🎁 Competition : Runex gives away $100 in rex coins🤑
🎁 10 winners will each receive 💸100 in #Rex tokens
👥To participate:
🔰Subscribe to the Runex Twitterpage and repost the attached post
🔰Subscribe to Runex Telegram Channel and Chat
🔰In the chat say : "I want a Rex"
🔰Enter your ETH-wallet address on the form or in the chat room
🔗Airdrop Link:Go to airdrop page
⏰ 22 Apr 12 AM (UTC) - 24 Apr 12 AM (UTC)
Disclaimer: Airdrop is 100% free. Don't send any fee or penny for receiving airdrop tokens. Just join airdrop for free!
💧Airdrop :Runex Giveaway💧
📣Complete Task: ➕ 1000 #Runex
🏆 Winners: 200 people will get 100 #Rex each
📅 End date: The contest will end after the start of the official airdrop.
💎Ratings: ⭐️⭐️⭐️
🔛RunexGiveaway Form Click 🔛
🌀 Join Runex group & channel.
🌀 Follow on Twitter, like and retweet the pinned post.
🌀 Submit your ETH Wallet address
📡 Enter your information to the airdrop page.
🗞Note: All airdrop steps should be completed.