В фреймворке 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
😄What
➖➖➖➖➖➖
🔘What can be used in questions to ask for information.
What time do you usually wake up?What time do you usually wake up?
🔘We can also use what in questions to show that we are surprised.
What?! You wake up at noon?What?! You wake up at noon?
🔘We can use what on its own to ask someone to say something again.
🔜I don't like chocolate. What? I don't really like chocolate.
🔘What can introduce an opinion.
🔜What a cute puppy!
#What👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
*This world indeed is nothing, just last weekend we were enjoying with you in all occasions we attended.. You even promised to hung around with us till January only for you to leave us unannounced without even saying goodbye to me.. #What a great lost!! 😭😭*
*I love you but God loves you more.. #RIP My December Salary*
😭😭😭😭😭😭😭😭😭
@jokearoundtheglobe
Q-q起q名m风f波b- 起名风波 Le prénom (2012)
直达链接:https://pan.quark.cn/s/42406d845ae2
#起名风波#Le prénom
#名字#What's in a Name
链接:https://link3.cc/sf_com
#电影#喜剧#其他#10年代