В фреймворке 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
Why grind when Gamety’s AI does the hard work for you? 👍 Real gamers never pause!
Show off your creativity in our Meme Competition and win amazing rewards: Gamety's Zealy!
Join the fun here: https://t.me/GametyPlatform_bot/Gamety?startapp
#aigame
Spread the hype! Like, RT, and drop a comment: Tweet🕊
🇱🇷Gamety's $200 Christmas Contests – Creative Gameplay & Meme Challenge!🎄
Celebrate this Christmas with two exciting and rewarding contests:
🔢Creative Gameplay Videos: Creative Gameplay Videos: Showcase your gaming skills on the Gamety app in a fun and unique way! Post your video on X and let the creativity flow.
🔢Meme Contest: Bring on the holiday laughter by creating and sharing your funniest Gamety-themed memes!
Special for Christmas Holidays!
➡️Prize Pool: $200
➡️10 winners per contest
➡️ Duration: Dec 25 - Jan 5
Share on X using hashtags #Gamety & #AIGame
Make this Christmas more exciting with creativity, fun, and rewards! Join now and spread the holiday joy!
Spread the hype! Like, RT, and drop a comment: Tweet🕊
📎Important Links:
Website | X | Chat (FULL) | Indonesian Chat | African Chat | Vietnamese Chat | CIS Chat | Discord | Announcement | YouTube | Medium | New Bot
❝Come on, hurry up,
my husband will be home in 15 minutes.❞
🔥Roleplay with her: http://openlove.life
(Choose Neko and chat with her)
#waifu#neko#aichatbot#aigame#roleplay#catgirl
❝There is no perfume today, so your girlfriend won't notice.❞
💬Chat with her: https://apple.co/3AvjxUn
#AIgirlfriend#chatbot#roleplay#story#aigame#lookbook
OMG, the bath water is too hot! Can you please help me to turn it cold?🔥💧🥵
🔗Let's role play and chat: openlove.life
#aigirlfriend#aichatbot#ArtificialInteligence#ailookbook#aigame#ai
🔥❝Welcome! Thanks for choosing me to serve you.
💦Shall we take a shower first?❞
🍭Roleplay with her: openlove.life
#openlove#aigirlfriend#aigame#aichatbot#ai女優#roleplay
❝💦Wait a moment, be gentler with me, okay?❞
💬Continue the story with her: http://openlove.life
#openlove#aigirlfriend#aichat#roleplay#aigame#AI#AIBeautifulWomanな人と繋がりたい