В фреймворке 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
🎬 BOOM! SingSing’s brand-new TVC has landed! 🎬
Get ready to dive into the premier launchpool and social gaming platform! Where games, and epic rewards are just the beginning. 🎶💎
🔥 Watch now and catch the SingSing vibe!
👉 Video link: https://youtu.be/dneU7k6fnH0
Like, Share the TVC to earn $KARA Reward in Tycoon Game!
#SingSing#TVC#SocialGaming#PlayAndEarn
🚨 IDO is coming! 🚨
Get ready to join the action, secure your spot for exclusive Airdrops, and count down with us ⏳💥
👉 Stay tuned & follow for updates!
#IDO#Airdrop#StayTuned#SingSing#SocialGaming#CryptoRewards
🎤Announcement | Chat | X (Twitter) | Website | Game
🚀 Thrilled to announce our partnership with K.O.I! 🎉
K.O.I is a Revolutionary Leap in Social Gaming with AI-Enhanced Virtual Pets. Together, we're taking a revolutionary leap in social gaming with AI-enhanced virtual pets.
🐾 Get ready for an extraordinary journey with SingSing and K.O.I! 🌟
#SingSing#KOI#Partnership#SocialGaming#AIVirtualPets